mirror of
https://github.com/MariaDB/server.git
synced 2025-02-13 17:05:35 +01:00
![Marko Mäkelä](/assets/img/avatar_default.png)
In my merge of the MySQL fix for Oracle Bug#23333990 / WL#9513 I overlooked some subsequent revisions to the test, and I also failed to notice that the test is actually always failing. Oracle introduced the parameter innodb_stats_include_delete_marked but failed to consistently take it into account in FOREIGN KEY constraints that involve CASCADE or SET NULL. When innodb_stats_include_delete_marked=ON, obviously the purge of delete-marked records should update the statistics as well. One more omission was that statistics were never updated on ROLLBACK. We are fixing that as well, properly taking into account the parameter innodb_stats_include_delete_marked. dict_stats_analyze_index_level(): Simplify an expression. (Using the ternary operator with a constant operand is unnecessary obfuscation.) page_scan_method_t: Revert the change done by Oracle. Instead, examine srv_stats_include_delete_marked directly where it is needed. dict_stats_update_if_needed(): Renamed from row_update_statistics_if_needed(). row_update_for_mysql_using_upd_graph(): Assert that the table statistics are initialized, as guaranteed by ha_innobase::open(). Update the statistics in a consistent way, both for FOREIGN KEY triggers and for the main table. If FOREIGN KEY constraints exist, do not dereference a freed pointer, but cache the proper value of node->is_delete so that it matches prebuilt->table. row_purge_record_func(): Update statistics if innodb_stats_include_delete_marked=ON. row_undo_ins(): Update statistics (on ROLLBACK of a fresh INSERT). This is independent of the parameter; the record is not delete-marked. row_undo_mod(): Update statistics on the ROLLBACK of updating key columns, or (if innodb_stats_include_delete_marked=OFF) updating delete-marks. innodb.innodb_stats_persistent: Renamed and extended from innodb.innodb_stats_del_mark. Reduced the unnecessarily large dataset from 262,144 to 32 rows. Test both values of the configuration parameter innodb_stats_include_delete_marked. Test that purge is updating the statistics. innodb_fts.innodb_fts_multiple_index: Adjust the result. The test is performing a ROLLBACK of an INSERT, which now affects the statistics. include/wait_all_purged.inc: Moved from innodb.innodb_truncate_debug to its own file.
49 lines
1.3 KiB
Text
49 lines
1.3 KiB
Text
--source include/have_innodb.inc
|
|
--source include/have_debug.inc
|
|
--source include/have_debug_sync.inc
|
|
--source include/count_sessions.inc
|
|
|
|
--echo #
|
|
--echo # Bug #23070734 CONCURRENT TRUNCATE TABLES CAUSE STALLS
|
|
--echo #
|
|
|
|
create table t1 (f1 int ,f2 int,key(f2)) engine=innodb;
|
|
begin;
|
|
insert into t1 values (10,45),(20,78),(30,88),(40,23),(50,78),(60,11),(70,56),(80,90);
|
|
delete from t1;
|
|
|
|
connect (con2,localhost,root,,);
|
|
# Stop the purge thread
|
|
START TRANSACTION WITH CONSISTENT SNAPSHOT;
|
|
|
|
connection default;
|
|
# Ensure that the history list length will actually be decremented by purge.
|
|
SET @saved_frequency = @@GLOBAL.innodb_purge_rseg_truncate_frequency;
|
|
SET GLOBAL innodb_purge_rseg_truncate_frequency = 1;
|
|
commit;
|
|
|
|
connect (con1,localhost,root,,);
|
|
SET DEBUG_SYNC= 'buffer_pool_scan SIGNAL started WAIT_FOR finish_scan';
|
|
send truncate table t1;
|
|
|
|
connection con2;
|
|
SET DEBUG_SYNC= 'now WAIT_FOR started';
|
|
# Allow purge to proceed, by discarding our read view.
|
|
COMMIT;
|
|
disconnect con2;
|
|
|
|
connection default;
|
|
--source include/wait_all_purged.inc
|
|
|
|
SET GLOBAL innodb_purge_rseg_truncate_frequency = @saved_frequency;
|
|
|
|
SET DEBUG_SYNC = 'now SIGNAL finish_scan';
|
|
|
|
connection con1;
|
|
reap;
|
|
disconnect con1;
|
|
|
|
connection default;
|
|
SET DEBUG_SYNC = 'RESET';
|
|
drop table t1;
|
|
--source include/wait_until_count_sessions.inc
|