Pushbuild fixes:
- Make MAX_SEL_ARGS smaller (even 16K records_in_range() calls is
more than it makes sense to do in typical cases)
- Don't call sel_arg->test_use_count() if we've already allocated
more than MAX_SEL_ARGs elements. The test will succeed but will take
too much time for the test suite (and not provide much value).
mysql-test/r/range.result:
BUG#26624: high mem usage (crash) in range optimizer
Pushbuild fixes: make the test go faster
mysql-test/t/range.test:
BUG#26624: high mem usage (crash) in range optimizer
Pushbuild fixes: make the test go faster
- Added PARAM::alloced_sel_args where we count the # of SEL_ARGs
created by SEL_ARG tree cloning operations.
- Made the range analyzer to shortcut and not do any more cloning
if we've already created MAX_SEL_ARGS SEL_ARG objects in cloning.
- Added comments about space complexity of SEL_ARG-graph
representation.
mysql-test/r/range.result:
BUG#26624: Testcase
mysql-test/t/range.test:
BUG#26624: Testcase
causes incorrect duplicate entries
Keys for BTREE indexes on ENUM and SET columns of MEMORY tables
with character set UTF8 were computed incorrectly. Many
different column values got the same key value.
Apart of possible performance problems, it made unique indexes
of this type unusable because it rejected many different
values as duplicates.
The problem was that multibyte character detection was tried
on the internal numeric column value. Many values were not
identified as characters. Their key value became blank filled.
Thanks to Alexander Barkov and Ramil Kalimullin for the patch,
which sets the character set of ENUM and SET key segments to
the pseudo binary character set.
mysql-test/r/heap_btree.result:
Bug#24985 - UTF8 ENUM primary key on MEMORY using BTREE
causes incorrect duplicate entries
Added test result.
mysql-test/t/heap_btree.test:
Bug#24985 - UTF8 ENUM primary key on MEMORY using BTREE
causes incorrect duplicate entries
Added test.
sql/ha_heap.cc:
Bug#24985 - UTF8 ENUM primary key on MEMORY using BTREE
causes incorrect duplicate entries
Set key segment charset to my_charset_bin for ENUM and SET
columns.
to 0 causes wrong (large) length to be read
from the row in _mi_calc_blob_length() when
storing NULL values in (e.g) POINT columns.
This large length is then used to allocate
a block of memory that (on some OSes) causes
trouble.
Fixed by calling the base class's
Field_blob::reset() from Field_geom::reset()
that is called when storing a NULL value into
the column.
mysql-test/r/gis.result:
Bug #27164: test case
mysql-test/t/gis.test:
Bug #27164: test case
sql/field.h:
Bug #27164: not reseting the data pointer
to 0 causes wrong (large) length to be read
from the row in _mi_calc_blob_length() when
storing NULL values in (e.g) POINT columns.
This large length is then used to allocate
a block of memory that (on some OSes) causes
trouble.
fix for cast( AS DATETIME) + 0 operation.
I just implemented Item_datetime_typecast::val() method
as it is usually done in other classes.
Should be fixed more radically in 5.0
mysql-test/r/type_datetime.result:
result added
mysql-test/t/type_datetime.test:
testcase
sql/item_timefunc.h:
added double conversion to Item_datetime_typecast
Using a MEMORY table BTREE index for scanning for updatable rows
could lead to an infinite loop.
Everytime a key was inserted into a btree index, the position
in the index scan was cleared. The search started from the
beginning and found the same key again.
Now we do not clear the position on key insert an more.
heap/hp_write.c:
Bug#26996 - Update of a Field in a Memory Table ends with wrong result
Removed the index-scan-breaking nulling of last_pos.
The comment behind this line ("For heap_rnext/heap_rprev")
was misleading. It should have been "Breaks heap_rnext/heap_rprev".
mysql-test/r/heap_btree.result:
Bug#26996 - Update of a Field in a Memory Table ends with wrong result
Added test result.
mysql-test/t/heap_btree.test:
Bug#26996 - Update of a Field in a Memory Table ends with wrong result
Added test.
when index is used
When the table contained TEXT columns with empty contents
('', zero length, but not NULL) _and_ strings starting with
control characters like tabulator or newline, the empty values
were not found in a "records in range" estimate. Hence count(*)
missed these records.
The reason was a different set of search flags used for key
insert and key range estimation.
I decided to fix the set of flags used in range estimation.
Otherwise millions of databases around the world would require
a repair after an upgrade.
The consequence is that the manual must be fixed, which claims
that TEXT columns are compared with "end space padding". This
is true for CHAR/VARCHAR but wrong for TEXT. See also bug 21335.
myisam/mi_range.c:
Bug#26231 - select count(*) on myisam table returns wrong value
when index is used
Added SEARCH_UPDATE to the search flags so that it compares
like write/update/delete operations do. Only so it expects
the keys at the place where they have been inserted.
myisam/mi_search.c:
Bug#26231 - select count(*) on myisam table returns wrong value
when index is used
Added some comments to explain how _mi_get_binary_pack_key()
works.
mysql-test/r/myisam.result:
Bug#26231 - select count(*) on myisam table returns wrong value
when index is used
Added a test.
mysql-test/t/myisam.test:
Bug#26231 - select count(*) on myisam table returns wrong value
when index is used
Added test result.
differences in tables
Certain merge tables were wrongly reported as having incorrect definition:
- Some fields that are 1 byte long (e.g. TINYINT, CHAR(1)), might
be internally casted (in certain cases) to a different type on a
storage engine layer. (affects 4.1 and up)
- If tables in a merge (and a MERGE table itself) had short VARCHAR column (less
than 4 bytes) and at least one (but not all) tables were ALTER'ed (even to an
identical table: ALTER TABLE xxx ENGINE=yyy), table definitions went ouf of
sync. (affects 4.1 only)
This is fixed by relaxing a check for underlying conformance and setting
field type to FIELD_TYPE_STRING in case varchar is shorter than 4
when a table is created.
myisam/mi_create.c:
Added a comment.
mysql-test/r/merge.result:
A test case for bug#26881.
mysql-test/t/merge.test:
A test case for bug#26881.
sql/ha_myisam.cc:
Relaxed some checks performed by check_definition():
As comparing of fulltext keys (and key segments) is not yet implemented,
only return an error in case one of keys is fulltext and other is not.
Otherwise, if both keys are fulltext, accept them as is.
As comparing of spatial keys (and key segments) is not yet implemented,
only return an error in case one of keys is spatial and other is not.
Otherwise, if both keys are spatial, accept them as is.
A workaround to handle situation when field is casted from FIELD_SKIP_ZERO
to FIELD_NORMAL. This could happen only in case field length is 1 and row
format is fixed.
sql/sql_parse.cc:
When a table that has varchar field shorter than 4 is created, field type is
set to FIELD_TYPE_VAR_STRING. Later, when a table is modified using alter
table, field type is changed to FIELD_TYPE_STRING (see Field_string::type).
That means HA_OPTION_PACK_RECORD flag might be lost and thus null_bit might
be shifted by alter table, in other words alter table doesn't create 100%
equal table definition.
This is usually not a problem, since when a table is created/altered,
definition on a storage engine layer is based on one that is passed from
sql layer. But it is a problem for merge engine - null_bit is shifted when
a table (merge or underlying) is altered.
Set field type to FIELD_TYPE_STRING in case FIELD_TYPE_VAR_STRING is shorter
than 4 when a table is created as it is done in Field::type.
incorrect key file for table
In certain cases it could happen that deleting a row could
corrupt an RTREE index.
According to Guttman's algorithm, page underflow is handled
by storing the page in a list for later re-insertion. The
keys from the stored pages have to be inserted into the
remaining pages of the same level of the tree. Hence the
level number is stored in the re-insertion list together
with the page.
In the MySQL RTree implementation the level counts from zero
at the root page, increasing numbers for levels down the tree.
If during re-insertion of the keys the tree height grows, all
level numbers become invalid. The remaining keys will be
inserted at the wrong level.
The fix is to increment the level numbers stored in the
reinsert list after a split of the root block during reinsertion.
myisam/rt_index.c:
Bug#25673 - spatial index corruption, error 126
incorrect key file for table
Added a loop in rtree_delete() to increment the level numbers
stored in the reinsert list after a split of the root block
during reinsertion.
Added comments and DBUG statements.
myisam/rt_key.c:
Bug#25673 - spatial index corruption, error 126
incorrect key file for table
Added DBUG statements.
myisam/rt_split.c:
Bug#25673 - spatial index corruption, error 126
incorrect key file for table
Added DBUG statements.
mysql-test/r/gis-rtree.result:
Bug#25673 - spatial index corruption, error 126
incorrect key file for table
Added the test result.
mysql-test/t/gis-rtree.test:
Bug#25673 - spatial index corruption, error 126
incorrect key file for table
Added a test.
Using INSERT DELAYED on MERGE tables could lead to table
corruptions.
The manual lists a couple of storage engines, which can be
used with INSERT DELAYED. MERGE is not in this list.
The attempt to try it anyway has not been rejected yet.
This bug was not detected earlier as it can work under
special circumstances. Most notable is low concurrency.
To be safe, this patch rejects any attempt to use INSERT
DELAYED on MERGE tables.
mysql-test/r/merge.result:
Bug#26464 - insert delayed + update + merge = corruption
Added test result.
mysql-test/t/merge.test:
Bug#26464 - insert delayed + update + merge = corruption
Added test.
sql/ha_myisammrg.h:
Bug#26464 - insert delayed + update + merge = corruption
Removed HA_CAN_INSERT_DELAYED flag from table_flags().
The insert delayed thread upgrades the lock from the first
entry in MYSQL_LOCK::locks only. Hence it is incapable to
handle MERGE tables, which have as many entries in this
array as they have MyISAM sub-tables.
When the ORDER BY clause gets fixed it's allowed to search in the current
item_list in order to find aliased fields and expressions. This is ok for a
SELECT but wrong for an UPDATE statement. If the ORDER BY clause will
contain a non-existing field which is mentioned in the UPDATE set list
then the server will crash due to using of non-existing (0x0) field.
When an Item_field is getting fixed it's allowed to search item list for
aliased expressions and fields only for selects.
sql/sql_base.cc:
Bug#25126: Wrongly resolved field leads to a crash.
When an Item_field is getting fixed it's allowed to search item list for
aliased expressions and fields only for selects.
sql/sql_select.cc:
Bug#25126: Wrongly resolved field leads to a crash.
When an Item_field is getting fixed it's allowed to search item list for
aliased expressions and fields only for selects.
mysql-test/r/update.result:
Added a test case for bug#25126: Wrongly resolved field leads to a crash.
mysql-test/t/update.test:
Added a test case for bug#25126: Wrongly resolved field leads to a crash.
Having maybe_null flag unset for geometry/spatial functions leads to
wrong Item_func_isnull::val_int()'s results.
Fix: set maybe_null flag and add is_null() methods.
mysql-test/r/gis.result:
Fix for bug #26038: X() value of empty NOT NULL POINT is neither NULL nor NOT NULL
- test result.
mysql-test/t/gis.test:
Fix for bug #26038: X() value of empty NOT NULL POINT is neither NULL nor NOT NULL
- test case.
sql/item_geofunc.cc:
Fix for bug #26038: X() value of empty NOT NULL POINT is neither NULL nor NOT NULL
- set maybe_null flag for Item_geometry_func and Item_func_as_wkt.
- moved length check to the beginnig of the
Item_func_spatial_collection::val_str() to affect geometry
collection objects at once.
- changed Item_func_isempty::val_int() and Item_func_issimple::val_int()
to properly handle null_value.
sql/item_geofunc.h:
Fix for bug #26038: X() value of empty NOT NULL POINT is neither NULL nor NOT NULL
- set maybe_null flag for geometry/spatial functions.
- added is_null() to Item_geometry_func and Item_func_spatial_rel
classes.
sql/spatial.cc:
Fix for bug #26038: X() value of empty NOT NULL POINT is neither NULL nor NOT NULL
- changed return type of Geometry::create_from_wkb() to be
consistent with Geometry::create_from_wkt(), now it returns
Geometry object or NULL in case of error.
sql/spatial.h:
Fix for bug #26038: X() value of empty NOT NULL POINT is neither NULL nor NOT NULL
- changed return type of Geometry::create_from_wkb() to be
consistent with Geometry::create_from_wkt(), now it returns
Geometry object or NULL in case of error.
- Starting time of a query sent by file bootstrapping wasn't initialized
and starting time defaulted to 0. This later used value by the Now-
item and is translated to 1970-01-01 11:00:00.
- marking the time with thd->set_time() before the call to
mysql_parse resolves this issue.
mysql-test/r/init_file.result:
Appended test case
mysql-test/std_data/init_file.dat:
Appended test case
mysql-test/t/init_file.test:
Appended test case
into zippy.cornsilk.net:/home/cmiller/work/mysql/mysql-4.1-maint
sql/item.cc:
Auto merged
sql/item_cmpfunc.cc:
Auto merged
sql/item_cmpfunc.h:
Auto merged
sql/sql_select.cc:
Auto merged
ENUMs weren't allowed to have character 0xff, a perfectly good character in some locales.
This was circumvented by mapping 0xff in ENUMs to ',', thereby prevent actual commas from
being used. Now if 0xff makes an appearance, we find a character not used in the enum and
use that as a separator. If no such character exists, we throw an error.
Any solution would have broken some sort of existing behaviour. This solution should
serve both fractions (those with 0xff and those with ',' in their enums), but
WILL REQUIRE A DUMP/RESTORE CYCLE FROM THOSE WITH 0xff IN THEIR ENUMS. :-/
That is, mysqldump with their current server, and restore when upgrading to one with
this patch.
mysql-test/r/type_enum.result:
Bug#24660: "enum" field type definition problem
Show that enums can now contain NAMES_SEP_CHAR (0xff, which is a perfectly respectable
char in some locales), or ',', or both.
mysql-test/t/type_enum.test:
Bug#24660: "enum" field type definition problem
Show that enums can now contain NAMES_SEP_CHAR (0xff, which is a perfectly respectable
char in some locales), or ',', or both.
sql/table.cc:
Bug#24660: "enum" field type definition problem
Revert fix for Bug#20922.
sql/unireg.cc:
Bug#24660: "enum" field type definition problem
Use a field-separator for ENUM-values that is not part of those values. If impossible,
throw error.
"update existingtable set anycolumn=nonexisting order by nonexisting" would crash
the server.
Though we would find the reference to a field, that doesn't mean we can then use
it to set some values. It could be a reference to another field. If it is NULL,
don't try to use it to set values in the Item_field and instead return an error.
Over the previous patch, this signals an error at the location of the error, rather
than letting the subsequent deref signal it.
mysql-test/r/order_by.result:
Verify that all permutations work.
mysql-test/t/order_by.test:
Verify that all permutations work.
sql/item.cc:
When the field is NULL, don't dereference it when we set_field().
Instead, raise an error.
into chilla.local:/home/mydev/mysql-4.1-axmrg
mysql-test/r/symlink.result:
Auto merged
mysql-test/t/symlink.test:
Auto merged
sql/mysqld.cc:
Auto merged
Notes:
This patch doesn't fix all issues in the tree and we need jani's fix for that
This patch shoud not be merged into 5.0
mysql-test/r/ps.result:
result fix
mysql-test/r/symlink.result:
result fix
mysql-test/t/ps.test:
test is moved to 'symlink' test
mysql-test/t/symlink.test:
test from 'ps' test
sql/field_conv.cc:
valgrind error fix: backport from 5.0
sql/mysqld.cc:
release of ssl_context
vio/viosslfactories.c:
release of ssl_context
mysql-test/valgrind.supp:
New BitKeeper file ``mysql-test/valgrind.supp''
This file is backported from 5.0, added suppressing of OpenSSL errors
into zippy.cornsilk.net:/home/cmiller/work/mysql/mysql-4.1-maint
configure.in:
Auto merged
mysql-test/mysql-test-run.pl:
Auto merged
scripts/mysqld_multi.sh:
Auto merged
sql/mysqld.cc:
Auto merged
into zippy.cornsilk.net:/home/cmiller/work/mysql/mysql-4.1-maint
configure.in:
Auto merged
mysql-test/r/range.result:
Auto merged
mysql-test/t/range.test:
Auto merged
When a merge table is opened compare column and key definition of
underlying tables against column and key definition of merge table.
If any of underlying tables have different column/key definition
refuse to open merge table.
mysql-test/r/merge.result:
A test case for WL#3456.
mysql-test/t/merge.test:
A test case for WL#3456.
sql/ha_myisam.cc:
Moved a part of code that converts TABLE object to MyISAM key and column
definition to a separate function.
Added check_definition() function that compares MyISAM table definitions.
sql/ha_myisammrg.cc:
Check if underlying table definition conforms to merge table definition,
and in case underlying table definition differs, refuse to open merge
table.
Depending on the queries we use different data processing methods
and can lose some data in case of double (and decimal in 4.1) fields.
The fix consists of two parts:
1. double comparison changed, now double a is equal to double b
if (a-b) is less than 5*0.1^(1 + max(a->decimals, b->decimals)).
For example, if a->decimals==1, b->decimals==2, a==b if (a-b)<0.005
2. if we use a temporary table, store double values there as is
to avoid any data conversion (rounding).
mysql-test/r/type_float.result:
fix for bug #19690: ORDER BY eliminates rows from the result
- test result
mysql-test/t/type_float.test:
fix for bug #19690: ORDER BY eliminates rows from the result
- test case
sql/field.cc:
fix for bug #19690: ORDER BY eliminates rows from the result
- use not_fixed flag instead of dec to check bounds.
sql/field.h:
fix for bug #19690: ORDER BY eliminates rows from the result
- Field_Double::not_fixed flag introduced, which is set if dec == NOT_FIXED_DEC
and is used in the ::store() to check bounds.
- new constructor introduced (with not_fixed_arg parameter).
sql/init.cc:
fix for bug #19690: ORDER BY eliminates rows from the result
- fill log_01[] array with 0.1 powers.
sql/item_cmpfunc.cc:
fix for bug #19690: ORDER BY eliminates rows from the result
- compare_real_fixed() and compare_e_real_fixed() introduced,
they consider double a == double b if a-b is less than 'precision',
'precision' is set to 5*0.1^(1 + max(a->decimals, b->decimals)),
for example, if a->decimals==1, b->decimals==2, 'precision' is 0.005
- use the above functions if both arguments are fixed.
sql/item_cmpfunc.h:
fix for bug #19690: ORDER BY eliminates rows from the result
- Arg_comparator::presision introduced.
- Arg_comparator::compare_real_fixed(), Arg_comparator::compare_e_real_fixed() introduced.
sql/mysql_priv.h:
fix for bug #19690: ORDER BY eliminates rows from the result
- log_01 array of 0.1 powers added.
sql/mysqld.cc:
fix for bug #19690: ORDER BY eliminates rows from the result
- log_01 array of 0.1 powers added.
sql/sql_select.cc:
fix for bug #19690: ORDER BY eliminates rows from the result
- if we create double field in a temporary table, set not_fixed flag
(use proper constructor) to avoid data conversion
in the Field_double::store(). Otherwise we can lose some data.
into chilla.local:/home/mydev/mysql-4.1-axmrg
mysql-test/r/symlink.result:
Auto merged
mysql-test/t/symlink.test:
Auto merged
mysql-test/r/myisam.result:
Manual merged
mysql-test/t/myisam.test:
Manual merged