archive storage engine headers don't include my_global.h first
During the build of 5.5.3-m3 on older Linux platforms
(kernels 2.4 or early 2.6),
the symptom described in the bug report occurred both
in the "archive" and in the "innobase" storage engine.
This change is the patch proposed in that bug report,
and a similar one in innobase, that latter is aligned
with Vasil Dimov of Innobase, the original author.
The unit test pfs_instr-t:
- generates a very long (10,000) bytes file name
- calls find_or_create_file.
This leads to a buffer overflow in mysys in my_realpath(),
because my_realpath and mysys file APIs in general do not
test for input parameters: mysys assumes every file name
is less that FN_REFLEN in length.
Calling find_or_create_file with a very long file name is likely
to happen when instrumenting third party code that does not use mysys,
so this test is legitimate.
The fix is to make find_or_create_file in the performance schema
more robust in this case.
The root cause of the failure is that when
Bug#51447 performance schema evil twin files
was fixed, instrumented file names got normalized.
The pfs-t unit test depends on this file normalization,
but it was not updated.
This fix aligns pfs-t.cc lookup_file_by_name()
with the logic in pfs_instr.cc find_or_create_file().
Fixed the missing initialization of locker_lost.
This fix is not strictly necessary, but is desirable to re-align the code
from 5.5 and 6.0, and reduce the spurious code differences.
This will facilitate maintenance and help to apply patches cleanly, for merges.
Before this fix, the performance schema file instrumentation would treat:
- a relative path to a file
- an absolute path to the same file
as two different files.
This would lead to:
- separate aggregation counters
- file leaks when a file is removed.
With this fix, a relative and absolute path are resolved to the same file instrument.
This change fixes test failure for partition_repair_myisam
and partition_recover_myisam.
The problem was that:
- the file std_data/corrupt_crash.MYI
contains charsetnr=63 (binary) for index segments.
- the new .frm file contains charsetnr=8 (latin1) for
the same segments.
As a result REPAIR refused to repair frm+MYI files
with different segment definition.
This fix restores the old behavior for frm and MYI files:
they now store charsetnr=63 for numeric/datetime data types.
This patch prevents system threads and system table accesses from
using user-specified values for "lock_wait_timeout". Instead all
such accesses are done using the default value (1 year).
This prevents background tasks (such as replication, events,
accessing stored function definitions, logging, reading time-zone
information, etc.) from failing in cases where the global value
of "lock_wait_timeout" is set very low.
The patch also simplifies the open tables API. Rather than adding
another convenience function for opening and locking system tables,
this patch removes most of the existing convenience functions for
open_and_lock_tables_derived(). Before, open_and_lock_tables() was
a convenience function that enforced derived tables handling, while
open_and_lock_tables_derived() was the main function where derived
tables handling was optional. Now, this convencience function is
gone and the main function is renamed to open_and_lock_tables().
No test case added as it would have required the use of --sleep to
check that system threads and system tables have a different timeout
value from the user-specified "lock_wait_timeout" system variable.
HAVE_IBGCC_ATOMIC_BUILTINS=>HAVE_IB_GCC_ATOMIC_BUILTINS.
Due to the typo, detection of atomics was broken.
It also lead to valgrind error during shutdown
(access to freed memory),which is likely present
in all builds where atomics are not used.
Table corruption happens during table reading in ha_tina::find_current_row() func.
Field::store() method returns error(true) if stored value is 0.
The fix:
added special case for enum type which correctly processes 0 value.
Additional fix:
INSERT...(default) and INSERT...() have the same behaviour now for enum type.
mysql-test/r/csv.result:
test result
mysql-test/r/default.result:
result fix
mysql-test/t/csv.test:
test case
sql/item.cc:
Changes:
do not print warning for 'enum' type if there is no default value.
set default value.
storage/csv/ha_tina.cc:
Table corruption happens during table reading in ha_tina::find_current_row() func.
Field::store() method returns error(true) if stored value is 0.
The fix:
added special case for enum type which correctly processes 0 value.
If a prepared statement used both a MyISAMMRG table and a stored
function or trigger, execution could fail with "No such table"
error or crash.
The error would come from a failure of the MyISAMMRG engine
to meet the expectations of the prelocking algorithm,
in particular maintain lex->query_tables_own_last pointer
in sync with lex->query_tables_last pointer/the contents
of lex->query_tables. When adding merge children, the merge
engine would extend the table list. Then, when adding
prelocked tables, the prelocking algorithm would use a pointer
to the last merge child to assign to lex->query_tables_own_last.
Then, when merge children were removed at the end of
open_tables(), lex->query_tables_own_last
was not updated, and kept pointing
to a removed merge child.
The fix ensures that query_tables_own_last is always in
sync with lex->query_tables_last.
This is a regression introduced by WL#4144 and present only
in next-4284 tree and 6.0.
mysql-test/r/merge.result:
Update results (Bug#47648).
mysql-test/t/merge.test:
Add a test case for Bug#47648.
Update the result file to reflect a fix of another bug
in MyISAMMRG code: not maintaining lex->query_tables_own_last
allowed a stored function or trigger to modify a merge table
which was already updated by the main statement.
It is not allowed for other storage engines, and should
not be allowed for MyISAMMRG.
storage/myisammrg/ha_myisammrg.cc:
When adding children to the list of tables to open,
make sure that we properly set lex->query_tables_own_last.
When removing the children, update lex->query_tables_own_last
if necessary.
mysql-test/t/disabled.def:
Restore disabled ssl tests: SSL certificates were updated.
Disable sp_sync.test, the test case can't work in next-4284.
mysql-test/t/partition_innodb.test:
Disable parsing of the test case for Bug#47343,
the test can not work in next-4284.
mysql-test/t/ps_ddl.test:
Update results (CREATE TABLE IF NOT EXISTS takes
into account existence of the temporary table).
Fix Bug#50555 "handler commands crash server in my_hash_first()"
as a post-merge fix (the new handler tests are not passing
otherwise).
- in hash.c, don't call calc_hash if ! my_hash_inited().
- add tests and results for the test case for Bug#50555
mysys/hash.c:
Assert that the hash is initialized when it's used.
sql/set_var.cc:
Check that the hash is initalized before using it (Bug#50555)
Server crashes when accessing ARCHIVE table with missing
.ARZ file.
When opening a table, ARCHIVE didn't properly pass through
error code from lower level azopen() to higher level open()
method.
mysql-test/r/archive.result:
A test case for BUG#48757.
mysql-test/t/archive.test:
A test case for BUG#48757.
storage/archive/ha_archive.cc:
Pass through error code from azopen().
Bulk REPLACE or bulk INSERT ... ON DUPLICATE KEY UPDATE may
break dynamic record MyISAM table.
The problem is limited to bulk REPLACE and INSERT ... ON
DUPLICATE KEY UPDATE, because only these operations may
be done via UPDATE internally and may request write cache.
When flushing write cache, MyISAM may write remaining
cached data at wrong position. Fixed by requesting write
cache to seek to a correct position.
mysql-test/r/myisam.result:
A test case for BUG#49628.
mysql-test/t/myisam.test:
A test case for BUG#49628.
storage/myisam/mi_dynrec.c:
delete_dynamic_record() may change data file position.
IO cache must be notified as it may still have cached
data, which has to be flushed later.
Performing fulltext prefix search (a word with truncation
operator) may cause a dead-loop. ft_min_word_len value
doesn't matter actually.
The problem was introduced along with "smarter index merge"
optimization.
mysql-test/r/fulltext.result:
A test case for BUG#50351.
mysql-test/t/fulltext.test:
A test case for BUG#50351.
storage/myisam/ft_boolean_search.c:
When going up to first-level tree, we need to restore docid[0],
so it informs fulltext index merge not to enter this second-level
tree again (avoiding dead-loop).