INSERT ... SELECT ...
Problem was that when bulk insert is used on an empty
table/partition, it disables the indexes for better
performance, but in this specific case it also tries
to read from that partition using an index, which is
not possible since it has been disabled.
Solution was to allow index reads on disabled indexes
if there are no records.
Also reverted the patch for bug#38005, since that was a workaround
in the partitioning engine instead of a fix in myisam.
mysql-test/r/partition.result:
Bug#46639: 1030 (HY000): Got error 124 from storage engine on
INSERT ... SELECT ...
updated result file
mysql-test/t/partition.test:
Bug#46639: 1030 (HY000): Got error 124 from storage engine on
INSERT ... SELECT ...
Added testcase
sql/ha_partition.cc:
Bug#46639: 1030 (HY000): Got error 124 from storage engine on
INSERT ... SELECT ...
reverted the patch for bug#38005, since that was a workaround
around this problem, not needed after fixing it in myisam.
storage/myisam/mi_search.c:
Bug#46639: 1030 (HY000): Got error 124 from storage engine on
INSERT ... SELECT ...
Return HA_ERR_END_OF_FILE instead of HA_ERR_WRONG_INDEX
when there are no rows.
column on partitioned table
An assertion 'ASSERT_COULUMN_MARKED_FOR_READ' is failed if the query
is executed with index containing double column on partitioned table.
The problem is that assertion expects all the fields which are read,
to be in the read_set.
In this query only the field 'a' is in the readset as the tables in
the query are joined by the field 'a' and so the assertion fails
expecting other field 'b'.
Since the function cmp() is just comparison of two parameters passed,
the assertion is not required.
Fixed by removing the assertion in the double fields comparision
function and also fixed the index initialization to do ordered
index scan with RW LOCK which ensures all the fields from a key are in
the read_set.
Note: this bug is not reproducible with other datatypes because the
assertion doesn't exist in comparision function for other
datatypes.
mysql-test/r/partition.result:
Testcase for BUG#45816
mysql-test/t/partition.test:
Testcase for BUG#45816
sql/field.cc:
Removed the assertion ASSERT_COLUMN_MARED_FOR_READ in Field_double::cmp()
function
sql/ha_partition.cc:
Fixed index_int() method to make it initialize the read_set properly if
ordered index scan with RW lock is requested.
We disallow the partitioning of a log table. You could however
partition a table first, and then point logging to it. This is
not only against the docs, it also crashes the server.
We catch this case now.
mysql-test/r/partition.result:
results for 40281
mysql-test/t/partition.test:
test for 40281: show that trying to log to partitioned table fails rather
to crash the server
sql/ha_partition.cc:
Signal that we no longer support logging to partitioned tables,
as per the docs.
sql/sql_partition.cc:
Some commands like "USE ..." have no select, yet we may try
to parse partition info after their execution if user set a
partitioned table as log target. This shouldn't lead to a
NULL-deref/crash.
Problem was that a failing rename just left the partitions at the state
it was at the failure.
Solution was to try to revert the started rename if a failure occured.
mysql-test/r/partition_not_embedded.result:
Bug#30102: Rename table does corrupt tables with partition files on failure
New result file
mysql-test/t/partition_not_embedded.test:
Bug#30102: Rename table does corrupt tables with partition files on failure
New test file
(list_files does not report the files in embedded)
sql/ha_partition.cc:
Bug#30102: Rename table does corrupt tables with partition files on failure
Better error handling for rename partitions (reverting the started rename
operation)
Different order of files for delete.
sql/handler.cc:
Bug#30102: Rename table does corrupt tables with partition files on failure
Tries to remove as many table files as possible
if the first delete succeeds.
the auto_increment value
This is an alternative patch that instead of allowing RECREATE TABLE
on TRUNCATE TABLE it implements reset_auto_increment that is called
after delete_all_rows.
Note: this bug was fixed by Mattias Jonsson:
Pusing this patch: http://lists.mysql.com/commits/70370
mysql-test/suite/parts/r/partition_auto_increment_memory.result:
Bug#35111: Truncate a MyISAM partitioned table does not reset
the auto_increment value
mysql-test/suite/parts/r/partition_auto_increment_myisam.result:
Bug#35111: Truncate a MyISAM partitioned table does not reset
the auto_increment value
sql/ha_partition.cc:
Bug#35111: Truncate a MyISAM partitioned table does not reset
the auto_increment value
Added reset_auto_increment, to be used after delete_all_rows
to simulate truncate.
storage/heap/ha_heap.cc:
Bug#35111: Truncate a MyISAM partitioned table does not reset
the auto_increment value
Added reset_auto_increment, to be used after delete_all_rows
to simulate truncate
storage/heap/ha_heap.h:
Bug#35111: Truncate a MyISAM partitioned table does not reset
the auto_increment value
Added reset_auto_increment, to be used after delete_all_rows
to simulate truncate
storage/myisam/ha_myisam.cc:
Bug#35111: Truncate a MyISAM partitioned table does not reset
the auto_increment value
Added reset_auto_increment, to be used after delete_all_rows
to simulate truncate.
storage/myisam/ha_myisam.h:
Bug#35111: Truncate a MyISAM partitioned table does not reset
the auto_increment value
Added reset_auto_increment, to be used after delete_all_rows
to simulate truncate.
Problem is that DATA_FREE in SHOW TABLE STATUS
is not correct when not using innodb_file_per_table.
The solution is to use I_S.PARTITIONS instead.
This is only a small fix for correcting mean record length and
always return 0 if the table is empty.
sql/ha_partition.cc:
Bug#36312: InnoDB DATA_FREE BUG?
This is only a small fix for correcting mean record length and
always return 0 if the table is empty.
Addition of hander function was_semi_consistent_read
mysql-test/r/partition_innodb_semi_consistent.result:
post push fix for bug#40595
Addition of hander function was_semi_consistent_read
Added test result
mysql-test/t/partition_innodb_semi_consistent-master.opt:
post push fix for bug#40595
Addition of hander function was_semi_consistent_read
Added test opt file
mysql-test/t/partition_innodb_semi_consistent.test:
post push fix for bug#40595
Addition of hander function was_semi_consistent_read
Added test case
sql/ha_partition.cc:
post push fix for bug#40595
Addition of hander function was_semi_consistent_read
The lack of was_semi_consistent_read opened a regression
for bug-31310 when useing a partitioned InnoDB table
'lock wait timeout exceeded'
Problem was a bug in the implementation of scan in partitioning
which masked the error code from the partition's handler.
Fixed by returning the value from the underlying handler.
mysql-test/suite/parts/r/partition_special_innodb.result:
Bug#40515: Query on a partitioned table does not return
'lock wait timeout exceeded'
Updated test result
mysql-test/suite/parts/t/partition_special_innodb.test:
Bug#40515: Query on a partitioned table does not return
'lock wait timeout exceeded'
Updated test case for covering the bug.
sql/ha_partition.cc:
Bug#40515: Query on a partitioned table does not return
'lock wait timeout exceeded'
Removing redeclaration of result variable,
which resulted in never returning the correct return value.
mysql-test/t/partition.test
sql/ha_partition.cc
Bug#40954: Crash in MyISAM index code with concurrency test using partitioned tables
Problem was usage of read_range_first with an empty key.
Solution was to not to give a key if it was empty. (real author Mattias Jonsson)
storage/archive/archive_reader.c
client/mysqlslap.c
Aligned the copyright texts output from "--version" of tools, to
let internal tools be able to change them if needed.
storage/ndb/test/tools/connect.cpp
storage/ndb/test/run-test/atrt.hpp
Corrected a few GPL headers not restricted to GPL version 2
Makefile.am
Added missing --report-features to the 'test-bt-fast' target
support-files/mysql.spec.sh
Reversed the removal of the "%define license GPL" in as internal
tools depended on it
Problem was usage of read_range_first with an empty key.
Solution was to not to give a key if it was empty.
mysql-test/r/partition.result:
Bug#40954: Crash in MyISAM index code with concurrency test using partitioned tables
Updated test result.
mysql-test/t/partition.test:
Bug#40954: Crash in MyISAM index code with concurrency test using partitioned tables
Added test case
on tables with partitions
Problem was that the handler function try_semi_consistent_read
was not propagated to the innodb handler.
Solution was to implement that function in the partitioning
handler.
mysql-test/r/partition_innodb.result:
Bug#40595: Non-matching rows not released with READ-COMMITTED
on tables with partitions
Updated test result.
mysql-test/t/partition_innodb.test:
Bug#40595: Non-matching rows not released with READ-COMMITTED
on tables with partitions
Added test case for bug#40595.
Note: the replace_regex is taking long time. I have not found
any better regex (it takes time using 'sed' too).
sql/ha_partition.cc:
Bug#40595: Non-matching rows not released with READ-COMMITTED
on tables with partitions
Added function to the partitioning handler for handling
semi consistent reads (unlock_row was already implemented,
and this is needed for unlock_row to work properly in innodb).
It uses pruning for optimizing the call.
sql/ha_partition.h:
Bug#40595: Non-matching rows not released with READ-COMMITTED
on tables with partitions
Added function to the partitioning handler for handling
semi consistent reads (unlock_row was already implemented,
and this is needed for unlock_row to work properly in innodb).
order by
Problem was that the first index read was unordered,
and the next was ordered, resulting in use of
uninitialized data.
Solution was to use the correct variable to see if
the 'next' call should be ordered or not.
mysql-test/r/partition.result:
Bug#40494: MYSQL server crashes on range access with
partitioning and order by
Added test case for the bug.
mysql-test/t/partition.test:
Bug#40494: MYSQL server crashes on range access with
partitioning and order by
Added test case for the bug.
sql/ha_partition.cc:
Bug#40494: MYSQL server crashes on range access with
partitioning and order by
Used the wrong variable to decide to continue with
ordered or unordered scan.
Problem was that partitioning cached the table flags.
These flags could change due to TRANSACTION LEVEL changes.
Solution was to remove the cache and always return the table flags
from the first partition (if the handler was initialized).
mysql-test/r/partition_innodb_stmt.result:
Bug#39084: Getting intermittent errors with statement-based binary logging
New test result file.
mysql-test/t/partition_innodb_stmt.test:
Bug#39084: Getting intermittent errors with statement-based binary logging
New test file.
sql/ha_partition.cc:
Bug#39084: Getting intermittent errors with statement-based binary logging
Removed m_table_flags, and added m_handler_status.
Added checks that all partitions have the same
table flags.
Moved some variable initializations.
Updated some comments.
Fixed typo initialise -> initialize
Changed HA_EXTTA_NO_READCHECK to do nothing, since it
is only used in ha_open, which is called for every
partition in ::open anyway.
sql/ha_partition.h:
Bug#39084: Getting intermittent errors with statement-based binary logging
Removed m_table_flags, and added m_handler_status.
Always return the first partitions table flags, instead of using
cached table flags.
Added define of enabled/disabled partitioning table flags
Fixed type initialise -> initialize
Updated some comments.
sql/handler.cc:
Bug#39084: Getting intermittent errors with statement-based binary logging
Fixed type initialise -> initialize.
sql/handler.h:
Bug#39084: Getting intermittent errors with statement-based binary logging
Added comment to understand where the cached value is set.
breaks auto increment
The auto_increment value was not initialized if
the first statement after opening a table was
an 'UPDATE'.
solution was to check initialize if it was not,
before trying to increase it in update.
mysql-test/suite/parts/inc/partition_auto_increment.inc:
Bug#40176: update as first partitioning statement
breaks auto increment
Added tests for verifying the bug and show some more
auto_increment flaws
mysql-test/suite/parts/r/partition_auto_increment_archive.result:
Bug#40176: update as first partitioning statement
breaks auto increment
Updated test results, due to added tests
mysql-test/suite/parts/r/partition_auto_increment_blackhole.result:
Bug#40176: update as first partitioning statement
breaks auto increment
Updated test results, due to added tests
mysql-test/suite/parts/r/partition_auto_increment_innodb.result:
Bug#40176: update as first partitioning statement
breaks auto increment
Updated test results, due to added tests
mysql-test/suite/parts/r/partition_auto_increment_memory.result:
Bug#40176: update as first partitioning statement
breaks auto increment
Updated test results, due to added tests
mysql-test/suite/parts/r/partition_auto_increment_myisam.result:
Bug#40176: update as first partitioning statement
breaks auto increment
Updated test results, due to added tests
mysql-test/suite/parts/r/partition_auto_increment_ndb.result:
Bug#40176: update as first partitioning statement
breaks auto increment
Updated test results, due to added tests
sql/ha_partition.cc:
Bug#40176: update as first partitioning statement
breaks auto increment
make sure that the auto_increment value is initialized
before updating it.
(missed initializing in mysql_update_row).
sql/ha_partition.h:
Bug#40176: update as first partitioning statement
breaks auto increment
Assert that it is initialized, before updating
the auto_increment value
on non-partitioned table
Problem was that partitioning specific commands was accepted
for non partitioned tables and treated like
ANALYZE/CHECK/OPTIMIZE/REPAIR TABLE, after bug-20129 was fixed,
which changed the code path from mysql_alter_table to
mysql_admin_table.
Solution was to check if the table was partitioned before
trying to execute the admin command
mysql-test/r/partition_mgm_err.result:
Bug#39434: ALTER TABLE CHECK/OPTIMIZE/ANALYZE PARTITION work
on non-partitioned table
Updated test result
mysql-test/t/partition_mgm_err.test:
Bug#39434: ALTER TABLE CHECK/OPTIMIZE/ANALYZE PARTITION work
on non-partitioned table
Updated test case
sql/ha_partition.cc:
Bug#39434: ALTER TABLE CHECK/OPTIMIZE/ANALYZE PARTITION work
on non-partitioned table
Simplified the code by using ALTER_ADMIN_PARTITION for all
commands that go through mysql_admin_tables and is set
for partitioning specific commands that.
sql/ha_partition.h:
Bug#39434: ALTER TABLE CHECK/OPTIMIZE/ANALYZE PARTITION work
on non-partitioned table
Simplified the code by using ALTER_ADMIN_PARTITION for all
commands that go through mysql_admin_tables and is set
for partitioning specific commands that.
sql/sql_lex.h:
Bug#39434: ALTER TABLE CHECK/OPTIMIZE/ANALYZE PARTITION work
on non-partitioned table
Simplified the code by using ALTER_ADMIN_PARTITION for all
commands that go through mysql_admin_tables and is set
for partitioning specific commands that.
Removed ALTER_ANALYZE/CHECK/OPTIMIZE/REPAIR_PARTITION and
added ALTER_ADMIN_PARTITION instead.
sql/sql_partition.cc:
Bug#39434: ALTER TABLE CHECK/OPTIMIZE/ANALYZE PARTITION work
on non-partitioned table
Simplified the code by using ALTER_ADMIN_PARTITION for all
commands that go through mysql_admin_tables and is set
for partitioning specific commands that.
Removed ALTER_ANALYZE/CHECK/OPTIMIZE/REPAIR_PARTITION and
added ALTER_ADMIN_PARTITION instead.
sql/sql_table.cc:
Bug#39434: ALTER TABLE CHECK/OPTIMIZE/ANALYZE PARTITION work
on non-partitioned table
Give error and return if trying partitioning admin command
on non partitioned table.
Simplified the code by using ALTER_ADMIN_PARTITION for all
commands that go through mysql_admin_tables and is set
for partitioning specific commands that.
Removed ALTER_ANALYZE/CHECK/OPTIMIZE/REPAIR_PARTITION and
added ALTER_ADMIN_PARTITION instead.
sql/sql_yacc.yy:
Bug#39434: ALTER TABLE CHECK/OPTIMIZE/ANALYZE PARTITION work
on non-partitioned table
Simplified the code by using ALTER_ADMIN_PARTITION for all
commands that go through mysql_admin_tables and is set
for partitioning specific commands that.
Removed ALTER_ANALYZE/CHECK/OPTIMIZE/REPAIR_PARTITION and
added ALTER_ADMIN_PARTITION instead.
index column
There was actually two problems
1) when clustered pk, order by non pk index should also
compare with pk as last resort to differ keys from each
other
2) bug in the index search handling in ha_partition (was
found when extending the test case
Solution to 1 was to include the pk in key compare if
clustered pk and search on other index.
Solution for 2 was to remove the optimization from
ordered scan to unordered scan if clustered pk.
mysql-test/r/partition_innodb.result:
Bug#37721: ORDER BY when WHERE contains non-partitioned
index column
updated test result.
mysql-test/t/partition_innodb.test:
Bug#37721: ORDER BY when WHERE contains non-partitioned
index column
Added test case for bug verification.
sql/ha_partition.cc:
Bug#37721: ORDER BY when WHERE contains non-partitioned
index column
using m_curr_key_info with both given index and PK
if clustered PK.
Also including PK in read_set.
Added debug prints for easier verification.
sql/ha_partition.h:
Bug#37721: ORDER BY when WHERE contains non-partitioned
index column
Changed m_curr_key_info to a null terminated array
with max 2 keys and a terminating null.
For use with key_rec_cmp with both given index and PK.
sql/key.cc:
Bug#37721: ORDER BY when WHERE contains non-partitioned
index column
added handling of a null terminated array of keys for
use in compare.
MyISAM blocks index usage for bulk insert into zero-records tables.
See ha_myisam::start_bulk_insert() lines from
...
if (file->state->records == 0 ...
...
That causes problems for partition engine when some partitions have records some not
as the engine uses same access method for all partitions.
Now partition engine doesn't call index_first/index_last
for empty tables.
per-file comments:
mysql-test/r/partition.result
Bug#38005 Partitions: error with insert select.
test result
mysql-test/t/partition.test
Bug#38005 Partitions: error with insert select.
test case
sql/ha_partition.cc
Bug#38005 Partitions: error with insert select.
ha_engine::index_first and
ha_engine::index_last not called for empty tables.
InnoDB Plugin locks table
The fast/on-line add/drop index handler calls was not implemented
whithin the partitioning.
This implements it in the partitioning handler.
Since this is only used by the not included InnoDB plugin, there
is no test case. (Have tested it manually with the plugin, and
it does not allow unique indexes not including partitioning
function, or removal of pk, which in innodb generates a new pk,
which is not in the partitioning function.)
NOTE: This introduces a new handler method, and because of that
changes the storage engine api. (One cannot use a handlerton to
see the capabilities of a table's handler if it is partitioned.
So I added a wrapper function in the handler that defaults to
the handlerton function, which the partitioning handler overrides.
sql/ha_partition.cc:
Bug#37453: Dropping/creating index on partitioned table with
InnoDB Plugin locks table
Added support for fast/on-line add/drop index.
Implemented alter_table_flags as bit-or of the partitioned
hton and the first partitions alter_table_flags.
It is only to forward the calls for the other functions:
check_if_incompatible_data
add_index
prepare_drop_index
final_drop_index
to all parts handler
sql/ha_partition.h:
Bug#37453: Dropping/creating index on partitioned table with
InnoDB Plugin locks table
Added support for fast/on-line add/drop index.
sql/handler.h:
Bug#37453: Dropping/creating index on partitioned table with
InnoDB Plugin locks table
Added the function on handler level, defaulting to use
the handlerton function, but a handler can override it.
Needed for partitioned tables.
NOTE: Change of storage engine api.
sql/sql_partition.cc:
Bug#37453: Dropping/creating index on partitioned table with
InnoDB Plugin locks table
Using the new handler function, instead of the handlerton
function. This works better with the partitioning handler.
sql/sql_table.cc:
Bug#37453: Dropping/creating index on partitioned table with
InnoDB Plugin locks table
Using the new handler function, instead of the handlerton
function. This works better with the partitioning handler.
Also using new process info for 'manage keys' (kind of fix
for bug-37550).
Removes the regression bug#38751.
sql/ha_partition.cc:
post push fix for bug#38804 (back port of bug#33479)
Removes the regression bug#38751.
archive relies on a ha_archive::info call to flush data before
the copy takes place in alter table.
This ensures that all partitions gets a info call, without having
to always forward info(HA_STATUS_AUTO) to all partitions.
and
Bug#33555: Group By Query does not correctly aggregate partitions
Backport of bug-33257 which is the same bug.
read_range_*() calls was not passed to the partition handlers,
but was translated to index_read/next family calls.
Resulting in duplicates rows and wrong aggregations.
mysql-test/r/partition_range.result:
Bug#30573: Ordered range scan over partitioned tables returns some rows twice
Updated result file
mysql-test/t/partition_range.test:
Bug#30573: Ordered range scan over partitioned tables returns some rows twice
Re-enabled the test
sql/ha_partition.cc:
Bug#30573: Ordered range scan over partitioned tables returns some rows twice
backport of bug-33257, correct handling of read_range_* calls,
without converting them to index_read/next calls
sql/ha_partition.h:
Bug#30573: Ordered range scan over partitioned tables returns some rows twice
backport of bug-33257, correct handling of read_range_* calls,
without converting them to index_read/next calls
Problem was a mutex added in bug n 27405 for solving a problem
with auto_increment in partitioned innodb tables.
(in ha_partition::write_row over partitions file->ha_write_row)
Solution is to use the patch for bug#33479, which refines the
usage of mutexes for auto_increment.
Backport of bug-33479 from 6.0:
Bug-33479: auto_increment failures in partitioning
Several problems with auto_increment in partitioning
(with MyISAM, InnoDB. Locking issues, not handling
multi-row INSERTs properly etc.)
Changed the auto_increment handling for partitioning:
Added a ha_data variable in table_share for storage engine specific data
such as auto_increment value handling in partitioning, also see WL 4305
and using the ha_data->mutex to lock around read + update.
The idea is this:
Store the table's reserved auto_increment value in
the TABLE_SHARE and use a mutex to, lock it for reading and updating it
and unlocking it, in one block. Only accessing all partitions
when it is not initialized.
Also allow reservations of ranges, and if no one has done a reservation
afterwards, lower the reservation to what was actually used after
the statement is done (via release_auto_increment from WL 3146).
The lock is kept from the first reservation if it is statement based
replication and a multi-row INSERT statement where the number of
candidate rows to insert is not known in advance (like INSERT SELECT,
LOAD DATA, unlike INSERT VALUES (row1), (row2),,(rowN)).
This should also lead to better concurrancy (no need to have a mutex
protection around write_row in all cases)
and work with any local storage engine.
mysql-test/suite/parts/inc/partition_auto_increment.inc:
Bug#38804: Query deadlock causes all tables to be inaccessible.
Backporting from 6.0 of:
Bug-33479: auto_increment failures in partitioning
Test source file for testing auto_increment
mysql-test/suite/parts/r/partition_auto_increment_archive.result:
Bug#38804: Query deadlock causes all tables to be inaccessible.
Backporting from 6.0 of:
Bug-33479: auto_increment failures in partitioning
result file for testing auto_increment
mysql-test/suite/parts/r/partition_auto_increment_blackhole.result:
Bug#38804: Query deadlock causes all tables to be inaccessible.
Backporting from 6.0 of:
Bug-33479: auto_increment failures in partitioning
result file for testing auto_increment
mysql-test/suite/parts/r/partition_auto_increment_innodb.result:
Bug#38804: Query deadlock causes all tables to be inaccessible.
Backporting from 6.0 of:
Bug-33479: auto_increment failures in partitioning
result file for testing auto_increment
mysql-test/suite/parts/r/partition_auto_increment_memory.result:
Bug#38804: Query deadlock causes all tables to be inaccessible.
Backporting from 6.0 of:
Bug-33479: auto_increment failures in partitioning
result file for testing auto_increment
mysql-test/suite/parts/r/partition_auto_increment_myisam.result:
Bug#38804: Query deadlock causes all tables to be inaccessible.
Backporting from 6.0 of:
Bug-33479: auto_increment failures in partitioning
result file for testing auto_increment
mysql-test/suite/parts/r/partition_auto_increment_ndb.result:
Bug#38804: Query deadlock causes all tables to be inaccessible.
Backporting from 6.0 of:
Bug-33479: auto_increment failures in partitioning
result file for testing auto_increment
mysql-test/suite/parts/t/partition_auto_increment_archive.test:
Bug#38804: Query deadlock causes all tables to be inaccessible.
Backporting from 6.0 of:
Bug-33479: auto_increment failures in partitioning
test file for testing auto_increment
mysql-test/suite/parts/t/partition_auto_increment_blackhole.test:
Bug#38804: Query deadlock causes all tables to be inaccessible.
Backporting from 6.0 of:
Bug-33479: auto_increment failures in partitioning
test file for testing auto_increment
mysql-test/suite/parts/t/partition_auto_increment_innodb.test:
Bug#38804: Query deadlock causes all tables to be inaccessible.
Backporting from 6.0 of:
Bug-33479: auto_increment failures in partitioning
test file for testing auto_increment
mysql-test/suite/parts/t/partition_auto_increment_memory.test:
Bug#38804: Query deadlock causes all tables to be inaccessible.
Backporting from 6.0 of:
Bug-33479: auto_increment failures in partitioning
test file for testing auto_increment
mysql-test/suite/parts/t/partition_auto_increment_myisam.test:
Bug#38804: Query deadlock causes all tables to be inaccessible.
Backporting from 6.0 of:
Bug-33479: auto_increment failures in partitioning
test file for testing auto_increment
mysql-test/suite/parts/t/partition_auto_increment_ndb.test:
Bug#38804: Query deadlock causes all tables to be inaccessible.
Backporting from 6.0 of:
Bug-33479: auto_increment failures in partitioning
test file for testing auto_increment
sql/ha_partition.cc:
Bug#38804: Query deadlock causes all tables to be inaccessible.
Backporting from 6.0 of:
Bug-33479: Failures using auto_increment and partitioning
Changed ha_partition::get_auto_increment from file->get_auto_increment
to file->info(HA_AUTO_STATUS), since it is works better with InnoDB
(InnoDB can have issues with partitioning and auto_increment,
where get_auto_increment sometimes can return a non updated value.)
Using the new table_share->ha_data for keeping the auto_increment
value, shared by all instances of the same table.
It is read+updated when holding a auto_increment specific mutex.
Also added release_auto_increment to decrease gaps if possible.
And a lock for multi-row INSERT statements where the number of candidate
rows to insert is not known in advance (like INSERT SELECT, LOAD DATA;
Unlike INSERT INTO (row1),(row2),,(rowN)).
Fixed a small bug, copied++ to (*copied)++ and the same for deleted.
Changed from current_thd, to ha_thd()
sql/ha_partition.h:
Bug#38804: Query deadlock causes all tables to be inaccessible.
Backporting from 6.0 of:
Bug-33479: Failures using auto_increment and partitioning
Added a new struct HA_DATA_PARTITION to be used in table_share->ha_data
Added a private function to set auto_increment values if needed
Removed the restore_auto_increment (the hander version is better)
Added lock/unlock functions for auto_increment handling.
Changed copied/deleted to const.
sql/handler.h:
Bug#38804: Query deadlock causes all tables to be inaccessible.
Backporting from 6.0 of:
Bug-33479: auto_increment failures in partitioning
Added const for changed_partitions
Added comments about SQLCOM_TRUNCATE for delete_all_rows
sql/table.h:
Bug#38804: Query deadlock causes all tables to be inaccessible.
Backporting from 6.0 of:
Bug-33479: Failures using auto_increment and partitioning
Added a variable in table_share: ha_data for storage of storage engine
specific data (such as auto_increment handling in partitioning).
post push fix for bug#20129, test failed due to non existing
source files.
mysql-test/Makefile.am:
Bug#20129: ALTER TABLE ... REPAIR PARTITION ... complains that
partition is corrupt
Test parts.partition_repair_myisam failed because the corrupted
pre fabricated files was not included in the dist-file.
mysql-test/suite/parts/r/partition_special_innodb.result:
Bug#34604: hander::ha_rnd_end(): Assertion inited==RND failed
updated result file
mysql-test/suite/parts/t/partition_special_innodb-master.opt:
Bug#34604: hander::ha_rnd_end(): Assertion inited==RND failed
Added parameter to speed up the test.
Set to 2 seconds to be working on slow machines.
mysql-test/suite/parts/t/partition_special_innodb.test:
Bug#34604: hander::ha_rnd_end(): Assertion inited==RND failed
Added test for verifying the bug (without the patch in
ha_partition.cc, this crashes a debug compiled server)
sql/ha_partition.cc:
Bug#34604: hander::ha_rnd_end(): Assertion inited==RND failed
In some cases error was not properly propagated through
ha_partition::rnd_next.
Will now return the error code from the partitions rnd_next and
update m_part_spec.start_part and m_last_part properly.
This makes the inited state to be correct.
Bug#35161
Fixed memory leak when failing to open a partition.
Bug#20129
Added tests for verifying REPAIR PARTITION.
mysql-test/std_data/parts/t1_will_crash#P#p1_first_1024.MYD:
Bug#20129: ALTER TABLE ... REPAIR PARTITION ... not working
(see mysql-test/suite/parts/t/partition_repair_myisam.test
Created by:
CREATE TABLE t1_will_crash (
a VARCHAR(255),
b INT,
c LONGTEXT,
PRIMARY KEY (a, b))ENGINE=MyISAM
PARTITION BY HASH (b)
PARTITIONS 7;
INSERT INTO t1_will_crash VALUES ...
and then
head -c 1024 var/master-data/test/t1_will_crash#P#p1.MYD
into this file.
mysql-test/std_data/parts/t1_will_crash#P#p2.MYD:
Bug#20129: ALTER TABLE ... REPAIR PARTITION ... not working
(see mysql-test/suite/parts/t/partition_repair_myisam.test)
copy of file right after _mi_mark_file_changed in mi_write
was done.
mysql-test/std_data/parts/t1_will_crash#P#p2.MYI:
Bug#20129: ALTER TABLE ... REPAIR PARTITION ... not working
(see mysql-test/suite/parts/t/partition_repair_myisam.test)
copy of file right after _mi_mark_file_changed in mi_write
was done.
mysql-test/std_data/parts/t1_will_crash#P#p3.MYI:
Bug#20129: ALTER TABLE ... REPAIR PARTITION ... not working
(see mysql-test/suite/parts/t/partition_repair_myisam.test)
copy of file right after *share->write_record was done.
mysql-test/std_data/parts/t1_will_crash#P#p4.MYI:
Bug#20129: ALTER TABLE ... REPAIR PARTITION ... not working
(see mysql-test/suite/parts/t/partition_repair_myisam.test)
copy of file right after flush_cached_blocks
mysql-test/std_data/parts/t1_will_crash#P#p6.MYD:
Bug#20129: ALTER TABLE ... REPAIR PARTITION ... not working
(see mysql-test/suite/parts/t/partition_repair_myisam.test)
copy of file right after _mi_write_part_record in
write_dynamic_record returned for the first time.
mysql-test/std_data/parts/t1_will_crash#P#p6_2.MYD:
Bug#20129: ALTER TABLE ... REPAIR PARTITION ... not working
(see mysql-test/suite/parts/t/partition_repair_myisam.test)
copy of file right after _mi_write_part_record in
write_dynamic_record returned for the second time.
mysql-test/std_data/parts/t1_will_crash#P#p6_3.MYD:
Bug#20129: ALTER TABLE ... REPAIR PARTITION ... not working
(see mysql-test/suite/parts/t/partition_repair_myisam.test)
copy of file right after _mi_write_part_record in
write_dynamic_record returned for the third time.
(data file fully updated).
mysql-test/suite/parts/r/partition_recover_myisam.result:
Bug#35161
Renamed since it was a test of recover
and to make repair free for use without
--myisam-recover
mysql-test/suite/parts/r/partition_repair_myisam.result:
Bug#20129: ALTER TABLE ... REPAIR PARTITION ... not working
New result file for testing CHECK/REPAIR of partitioned tables
mysql-test/suite/parts/t/partition_recover_myisam-master.opt:
Bug#35161
Renamed since it was a test of recover
and to make repair free for use without
--myisam-recover
mysql-test/suite/parts/t/partition_recover_myisam.test:
Bug#35161
Renamed since it was a test of recover
and to make repair free for use without
--myisam-recover
mysql-test/suite/parts/t/partition_repair_myisam.test:
Bug#20129: ALTER TABLE ... REPAIR PARTITION ... not working
New test file for testing CHECK/REPAIR of partitioned tables
sql/ha_partition.cc:
Bug#35161
Fix of memory leak when open of partition failed.
update accross partitions.
It's not Innodb-specific bug.
ha_partition::update_row() didn't set
table->timestamp_field_type= TIMESTAMP_NO_AUTO_SET when
orig_timestamp_type == TIMESTAMP_AUTO_SET_ON_INSERT.
So that a partition sets the timestamp field when a record
is moved to a different partition.
Fixed by doing '= TIMESTAMP_NO_AUTO_SET' unconditionally.
Also ha_partition::write_row() is fixed in same way as now
Field_timestamp::set() is called twice in SET_ON_INSERT case.
(Chad queues this patch on demand by Trudy/Davi.)
mysql-test/r/partition.result:
Bug#38272 timestamps fields incorrectly defaulted on update accross partitions.
test result
mysql-test/t/partition.test:
Bug#38272 timestamps fields incorrectly defaulted on update accross partitions.
test case
sql/ha_partition.cc:
Bug#38272 timestamps fields incorrectly defaulted on update accross partitions.
Do table->timestamp_field_type= TIMESTAMP_NO_AUTO_SET unconditionally
in ha_partition::update_row and ::write_row()
Post push fix (compiler warning)
sql/ha_partition.cc:
Bug#37402: Mysql cant read partitioned table with capital letter in the name
fix to prevent a compiler warning.
partition is corrupt
The main problem was that ALTER TABLE t ANALYZE/CHECK/OPTIMIZE/REPAIR
PARTITION took another code path (over mysql_alter_table instead of
mysql_admin_table) which differs in two ways:
1) alter table opens the tables in a different way than admin tables do
resulting in returning with error before it tried the command
2) alter table does not start to send any diagnostic rows to the client
which the lower admin functions continue to use -> resulting in
assertion crash
The fix:
Remapped ALTER TABLE t ANALYZE/CHECK/OPTIMIZE/REPAIR PARTITION to use
the same code path as ANALYZE/CHECK/OPTIMIZE/REPAIR TABLE t.
Adding check in mysql_admin_table to setup the partition list for
which partitions that should be used.
Partitioned tables will still not work with
REPAIR TABLE/PARTITION USE_FRM, since that requires moving partitions
to tables, REPAIR TABLE t USE_FRM, and check that the data still
fulfills the partitioning function and then move the table back to
being a partition.
NOTE: I have removed the following functions from the handler
interface:
analyze_partitions, check_partitions, optimize_partitions,
repair_partitions
Since they are not longer needed.
THIS ALTERS THE STORAGE ENGINE API
mysql-test/r/handler_innodb.result:
Bug#20129: ALTER TABLE ... REPAIR PARTITION ... complains that
partition is corrupt
Added a note result row.
mysql-test/r/innodb.result:
Bug#20129: ALTER TABLE ... REPAIR PARTITION ... complains that
partition is corrupt
Added a note result row.
mysql-test/r/innodb_mysql.result:
Bug#20129: ALTER TABLE ... REPAIR PARTITION ... complains that
partition is corrupt
Added a note result row.
mysql-test/r/partition.result:
Bug#20129: ALTER TABLE ... REPAIR PARTITION ... complains that
partition is corrupt
Updated after fixing ANALYZE/CHECK/OPTIMIZE/REPAIR partitioned
tables.
mysql-test/r/trigger-trans.result:
Bug#20129: ALTER TABLE ... REPAIR PARTITION ... complains that
partition is corrupt
Added a note result row.
mysql-test/suite/ndb/r/ndb_partition_key.result:
Bug#20129: ALTER TABLE ... REPAIR PARTITION ... complains that
partition is corrupt
Updated after fixing ANALYZE/CHECK/OPTIMIZE/REPAIR partitioned
tables.
mysql-test/suite/ndb/t/ndb_partition_key.test:
Bug#20129: ALTER TABLE ... REPAIR PARTITION ... complains that
partition is corrupt
Updated after fixing ANALYZE/CHECK/OPTIMIZE/REPAIR partitioned
tables.
mysql-test/suite/parts/inc/partition_alter4.inc:
Bug#20129: ALTER TABLE ... REPAIR PARTITION ... complains that
partition is corrupt
Updated after fixing ANALYZE/CHECK/OPTIMIZE/REPAIR partitioned
tables.
mysql-test/suite/parts/r/partition_alter4_innodb.result:
Bug#20129: ALTER TABLE ... REPAIR PARTITION ... complains that
partition is corrupt
Updated after fixing ANALYZE/CHECK/OPTIMIZE/REPAIR partitioned
tables.
mysql-test/suite/parts/r/partition_alter4_myisam.result:
Bug#20129: ALTER TABLE ... REPAIR PARTITION ... complains that
partition is corrupt
Updated after fixing ANALYZE/CHECK/OPTIMIZE/REPAIR partitioned
tables.
mysql-test/suite/rpl/r/rpl_failed_optimize.result:
Bug#20129: ALTER TABLE ... REPAIR PARTITION ... complains that
partition is corrupt
Added a note result row.
mysql-test/suite/rpl/r/rpl_innodb_mixed_dml.result:
Bug#20129: ALTER TABLE ... REPAIR PARTITION ... complains that
partition is corrupt
Added a note result row.
mysql-test/t/partition.test:
Bug#20129: ALTER TABLE ... REPAIR PARTITION ... complains that
partition is corrupt
Updated after fixing ANALYZE/CHECK/OPTIMIZE/REPAIR partitioned
tables.
sql/ha_partition.cc:
Bug#20129: ALTER TABLE ... REPAIR PARTITION ... complains that
partition is corrupt
Added a function for returning admin commands result rows
Updated handle_opt_partitions to handle admin commands result rows,
and some error filtering (as mysql_admin_table do).
Removed the functions analyze/check/optimize/repair_partitions
since they have no longer any use.
sql/ha_partition.h:
Bug#20129: ALTER TABLE ... REPAIR PARTITION ... complains that
partition is corrupt
Removed analyze/check/optimize/repair_partitions since they
are no longer are needed.
sql/handler.cc:
Bug#20129: ALTER TABLE ... REPAIR PARTITION ... complains that
partition is corrupt
Removed analyze/check/optimize/repair_partitions since they
are no longer are needed.
sql/handler.h:
Bug#20129: ALTER TABLE ... REPAIR PARTITION ... complains that
partition is corrupt
Removed analyze/check/optimize/repair_partitions since they
are no longer are needed.
sql/mysql_priv.h:
Bug#20129: ALTER TABLE ... REPAIR PARTITION ... complains that
partition is corrupt
Added set_part_state for reuse of code in mysql_admin_table.
(Originally fond in sql/sql_partition.cc:prep_alter_part_table)
sql/protocol.cc:
Bug#20129: ALTER TABLE ... REPAIR PARTITION ... complains that
partition is corrupt
Added one assert and a debug print.
sql/sql_partition.cc:
Bug#20129: ALTER TABLE ... REPAIR PARTITION ... complains that
partition is corrupt
Refactored code for setting up partition state, set_part_state,
now used in both prep_alter_part_table and
sql_table.cc:mysql_admin_table.
Removed code for handling ANALYZE/CHECK/OPTIMIZE/REPAIR partitions,
since it is now handled by mysql_admin_table.
sql/sql_table.cc:
Bug#20129: ALTER TABLE ... REPAIR PARTITION ... complains that
partition is corrupt
Added functionality in mysql_admin_table to work with partitioned
tables.
Fixed a possible assertion bug for HA_ADMIN_TRY_ALTER
(If analyze would output a row, it fails since the row was already
started).
sql/sql_yacc.yy:
Bug#20129: ALTER TABLE ... REPAIR PARTITION ... complains that
partition is corrupt
Remapped ALTER TABLE t ANALYZE/CHECK/OPTIMIZE/REPAIR PARTITION
to use the same code path as ANALYZE/CHECK/OPTIMIZE/REPAIR TABLE
instead of taking the ALTER TABLE path.
Added reset of alter_info for ANALYZE/CHECK/OPTIMIZE/REPAIR TABLE
since it is now used by partitioned tables.
storage/myisam/mi_check.c:
Bug#20129: ALTER TABLE ... REPAIR PARTITION ... complains that
partition is corrupt
Changed warning message from "Found X parts Should be: Y parts"
to "Found X key parts. Should be Y", since it could be confusing
with partitioned tables.
Problem was that ha_partition had HA_FILE_BASED flag set
(since it uses a .par file), but after open it uses the first partitions
flags, which results in different case handling for create and for
open.
Solution was to change the underlying partition name so it was consistent.
(Only happens when lower_case_table_names = 2, i.e. Mac OS X and storage
engines without HA_FILE_BASED, like InnoDB and Memory.)
(Recommit after adding rename of check_lowercase_names to
get_canonical_filename, and moved it from handler.h to mysql_priv.h)
NOTE: if a mixed case name for a partitioned table was created when
lower_case_table_name = 2 it should be renamed or dropped before using
the updated version (See bug#37402 for more info)
mysql-test/include/have_case_insensitive_file_system.inc:
Bug#37402: Mysql cant read partitioned table with capital letter in the name
Added include file.
mysql-test/include/have_lowercase0.inc:
Bug#37402: Mysql cant read partitioned table with capital letter in the name
moved case insensitive file system to a new file, leaving only
lower_case_table_names.
mysql-test/include/have_lowercase2.inc:
Bug#37402: Mysql cant read partitioned table with capital letter in the name
Added include file.
mysql-test/lib/mtr_report.pl:
Bug#37402: Mysql cant read partitioned table with capital letter in the name
Removed a duplicate row and suppressed warning about setting
lower_case_table_names to 2 on case sensitive file systems.
mysql-test/r/case_insensitive_file_system.require:
Bug#37402: Mysql cant read partitioned table with capital letter in the name
Added requirement file.
mysql-test/r/lowercase0.require:
Bug#37402: Mysql cant read partitioned table with capital letter in the name
moved case insensitive file system to a new file, leaving only
lower_case_table_names.
mysql-test/suite/parts/inc/partition_mgm.inc:
Bug#37402: Mysql cant read partitioned table with capital letter in the name
New include file for testing partitioning management functions for different
settings of lower_case_table_names.
mysql-test/suite/parts/r/partition_mgm_lc0_archive.result:
Bug#37402: Mysql cant read partitioned table with capital letter in the name
New result file.
mysql-test/suite/parts/r/partition_mgm_lc0_innodb.result:
Bug#37402: Mysql cant read partitioned table with capital letter in the name
New result file.
mysql-test/suite/parts/r/partition_mgm_lc0_memory.result:
Bug#37402: Mysql cant read partitioned table with capital letter in the name
New result file.
mysql-test/suite/parts/r/partition_mgm_lc0_myisam.result:
Bug#37402: Mysql cant read partitioned table with capital letter in the name
New result file.
mysql-test/suite/parts/r/partition_mgm_lc0_ndb.result:
Bug#37402: Mysql cant read partitioned table with capital letter in the name
New result file.
mysql-test/suite/parts/r/partition_mgm_lc1_archive.result:
Bug#37402: Mysql cant read partitioned table with capital letter in the name
New result file.
mysql-test/suite/parts/r/partition_mgm_lc1_innodb.result:
Bug#37402: Mysql cant read partitioned table with capital letter in the name
New result file.
mysql-test/suite/parts/r/partition_mgm_lc1_memory.result:
Bug#37402: Mysql cant read partitioned table with capital letter in the name
New result file.
mysql-test/suite/parts/r/partition_mgm_lc1_myisam.result:
Bug#37402: Mysql cant read partitioned table with capital letter in the name
New result file.
mysql-test/suite/parts/r/partition_mgm_lc1_ndb.result:
Bug#37402: Mysql cant read partitioned table with capital letter in the name
New result file.
mysql-test/suite/parts/r/partition_mgm_lc2_archive.result:
Bug#37402: Mysql cant read partitioned table with capital letter in the name
New result file.
mysql-test/suite/parts/r/partition_mgm_lc2_innodb.result:
Bug#37402: Mysql cant read partitioned table with capital letter in the name
New result file.
mysql-test/suite/parts/r/partition_mgm_lc2_memory.result:
Bug#37402: Mysql cant read partitioned table with capital letter in the name
New result file.
mysql-test/suite/parts/r/partition_mgm_lc2_myisam.result:
Bug#37402: Mysql cant read partitioned table with capital letter in the name
New result file.
mysql-test/suite/parts/r/partition_mgm_lc2_ndb.result:
Bug#37402: Mysql cant read partitioned table with capital letter in the name
New result file.
mysql-test/suite/parts/t/partition_mgm_lc0_archive.test:
Bug#37402: Mysql cant read partitioned table with capital letter in the name
New test file.
mysql-test/suite/parts/t/partition_mgm_lc0_innodb.test:
Bug#37402: Mysql cant read partitioned table with capital letter in the name
New test file.
mysql-test/suite/parts/t/partition_mgm_lc0_memory.test:
Bug#37402: Mysql cant read partitioned table with capital letter in the name
New test file.
mysql-test/suite/parts/t/partition_mgm_lc0_myisam.test:
Bug#37402: Mysql cant read partitioned table with capital letter in the name
New test file.
mysql-test/suite/parts/t/partition_mgm_lc0_ndb.test:
Bug#37402: Mysql cant read partitioned table with capital letter in the name
New test file.
mysql-test/suite/parts/t/partition_mgm_lc1_archive-master.opt:
Bug#37402: Mysql cant read partitioned table with capital letter in the name
New opt file.
mysql-test/suite/parts/t/partition_mgm_lc1_archive.test:
Bug#37402: Mysql cant read partitioned table with capital letter in the name
New test file.
mysql-test/suite/parts/t/partition_mgm_lc1_innodb-master.opt:
Bug#37402: Mysql cant read partitioned table with capital letter in the name
New opt file.
mysql-test/suite/parts/t/partition_mgm_lc1_innodb.test:
Bug#37402: Mysql cant read partitioned table with capital letter in the name
New test file.
mysql-test/suite/parts/t/partition_mgm_lc1_memory-master.opt:
Bug#37402: Mysql cant read partitioned table with capital letter in the name
New opt file.
mysql-test/suite/parts/t/partition_mgm_lc1_memory.test:
Bug#37402: Mysql cant read partitioned table with capital letter in the name
New test file.
mysql-test/suite/parts/t/partition_mgm_lc1_myisam-master.opt:
Bug#37402: Mysql cant read partitioned table with capital letter in the name
New opt file.
mysql-test/suite/parts/t/partition_mgm_lc1_myisam.test:
Bug#37402: Mysql cant read partitioned table with capital letter in the name
New test file.
mysql-test/suite/parts/t/partition_mgm_lc1_ndb-master.opt:
Bug#37402: Mysql cant read partitioned table with capital letter in the name
New opt file.
mysql-test/suite/parts/t/partition_mgm_lc1_ndb.test:
Bug#37402: Mysql cant read partitioned table with capital letter in the name
New test file.
mysql-test/suite/parts/t/partition_mgm_lc2_archive-master.opt:
Bug#37402: Mysql cant read partitioned table with capital letter in the name
New opt file.
mysql-test/suite/parts/t/partition_mgm_lc2_archive.test:
Bug#37402: Mysql cant read partitioned table with capital letter in the name
New test file.
mysql-test/suite/parts/t/partition_mgm_lc2_innodb-master.opt:
Bug#37402: Mysql cant read partitioned table with capital letter in the name
New opt file.
mysql-test/suite/parts/t/partition_mgm_lc2_innodb.test:
Bug#37402: Mysql cant read partitioned table with capital letter in the name
New test file.
mysql-test/suite/parts/t/partition_mgm_lc2_memory-master.opt:
Bug#37402: Mysql cant read partitioned table with capital letter in the name
New opt file.
mysql-test/suite/parts/t/partition_mgm_lc2_memory.test:
Bug#37402: Mysql cant read partitioned table with capital letter in the name
New test file.
mysql-test/suite/parts/t/partition_mgm_lc2_myisam-master.opt:
Bug#37402: Mysql cant read partitioned table with capital letter in the name
New opt file.
mysql-test/suite/parts/t/partition_mgm_lc2_myisam.test:
Bug#37402: Mysql cant read partitioned table with capital letter in the name
New test file.
mysql-test/suite/parts/t/partition_mgm_lc2_ndb-master.opt:
Bug#37402: Mysql cant read partitioned table with capital letter in the name
New opt file.
mysql-test/suite/parts/t/partition_mgm_lc2_ndb.test:
Bug#37402: Mysql cant read partitioned table with capital letter in the name
New test file.
mysql-test/t/lowercase_table3.test:
Bug#37402: Mysql cant read partitioned table with capital letter in the name
Moved case sensitive file system to a specific inc-file instead of
included in lowercase0.inc
sql/ha_partition.cc:
Bug#37402: Mysql cant read partitioned table with capital letter in the name
Problem was that ha_partition had HA_FILE_BASED set
(since it uses a .par file), but after open it uses the first partitions
table_flags(), which results in different case handling for create and for
open.
Solution was to change the underlying partition name so it was consistent.
(Only happens when lower_case_table_names = 2, i.e. Mac OS X)
sql/handler.cc:
Bug#37402: Mysql cant read partitioned table with capital letter in the name
Renamed check_lowercase_names to get_canonical_filename, and exported it
so that ha_partition.cc can use the function.
sql/mysql_priv.h:
Bug#37402: Mysql cant read partitioned table with capital letter in the name
Renamed check_lowercase_names to get_canonical_filename, and exported it
so that ha_partition.cc can use the function.