[MDEV-12625] total_index_blocks is uninitialized in ALTER TABLE…ALGORITHM=INPLACE of small tables Created: 2017-04-28  Updated: 2017-05-23  Resolved: 2017-05-23

Status: Closed
Project: MariaDB Server
Component/s: Storage Engine - InnoDB, Tests
Affects Version/s: 10.1
Fix Version/s: 10.1.24

Type: Bug Priority: Major
Reporter: Elena Stepanova Assignee: Marko Mäkelä
Resolution: Fixed Votes: 0
Labels: None

Issue Links:
Problem/Incident
is caused by MDEV-6812 Merge Kakao: Add global status variab... Closed
Sprint: 10.1.24

 Description   

http://buildbot.askmonty.org/buildbot/builders/work-amd64-valgrind/builds/10024/steps/test/logs/stdio

10.1 65a43605a42c069ede604826ede2d93d72c4fdd

innodb_fts.innodb_fts_misc 'innodb_plugin' w1 [ fail ]  Found warnings/errors in server log file!
        Test ended at 2017-04-27 13:26:03
line
==1854== Thread 22:
==1854== Conditional jump or move depends on uninitialised value(s)
==1854==    at 0xC0FE0FB: row_merge_build_indexes(trx_t*, dict_table_t*, dict_table_t*, bool, dict_index_t**, unsigned long const*, unsigned long, TABLE*, dtuple_t const*, unsigned long const*, unsigned long, ib_sequence_t&) (row0merge.cc:4202)
==1854==    by 0xC018846: ha_innodb::inplace_alter_table(TABLE*, Alter_inplace_info*) (handler0alter.cc:4249)
==1854==    by 0x6E90C6: handler::ha_inplace_alter_table(TABLE*, Alter_inplace_info*) (handler.h:3704)
==1854==    by 0x6E1256: mysql_inplace_alter_table(THD*, TABLE_LIST*, TABLE*, TABLE*, Alter_inplace_info*, enum_alter_inplace_result, MDL_request*, Alter_table_ctx*) (sql_table.cc:7133)
==1854==    by 0x6E5ACF: mysql_alter_table(THD*, char*, char*, HA_CREATE_INFO*, TABLE_LIST*, Alter_info*, unsigned int, st_order*, bool) (sql_table.cc:8945)
==1854==    by 0x75AFCD: Sql_cmd_alter_table::execute(THD*) (sql_alter.cc:325)
==1854==    by 0x6266AF: mysql_execute_command(THD*) (sql_parse.cc:5695)
==1854==    by 0x62A952: mysql_parse(THD*, char*, unsigned int, Parser_state*) (sql_parse.cc:7343)
==1854==    by 0x619942: dispatch_command(enum_server_command, THD*, char*, unsigned int) (sql_parse.cc:1490)
==1854==    by 0x61869C: do_command(THD*) (sql_parse.cc:1109)
==1854==    by 0x755CD5: do_handle_one_connection(THD*) (sql_connect.cc:1349)
==1854==    by 0x755A39: handle_one_connection (sql_connect.cc:1261)
==1854== Conditional jump or move depends on uninitialised value(s)
==1854==    at 0xC0FE3E2: row_merge_build_indexes(trx_t*, dict_table_t*, dict_table_t*, bool, dict_index_t**, unsigned long const*, unsigned long, TABLE*, dtuple_t const*, unsigned long const*, unsigned long, ib_sequence_t&) (row0merge.cc:4249)
==1854==    by 0xC018846: ha_innodb::inplace_alter_table(TABLE*, Alter_inplace_info*) (handler0alter.cc:4249)
==1854==    by 0x6E90C6: handler::ha_inplace_alter_table(TABLE*, Alter_inplace_info*) (handler.h:3704)
==1854==    by 0x6E1256: mysql_inplace_alter_table(THD*, TABLE_LIST*, TABLE*, TABLE*, Alter_inplace_info*, enum_alter_inplace_result, MDL_request*, Alter_table_ctx*) (sql_table.cc:7133)
==1854==    by 0x6E5ACF: mysql_alter_table(THD*, char*, char*, HA_CREATE_INFO*, TABLE_LIST*, Alter_info*, unsigned int, st_order*, bool) (sql_table.cc:8945)
==1854==    by 0x75AFCD: Sql_cmd_alter_table::execute(THD*) (sql_alter.cc:325)
==1854==    by 0x6266AF: mysql_execute_command(THD*) (sql_parse.cc:5695)
==1854==    by 0x62A952: mysql_parse(THD*, char*, unsigned int, Parser_state*) (sql_parse.cc:7343)
==1854==    by 0x619942: dispatch_command(enum_server_command, THD*, char*, unsigned int) (sql_parse.cc:1490)
==1854==    by 0x61869C: do_command(THD*) (sql_parse.cc:1109)
==1854==    by 0x755CD5: do_handle_one_connection(THD*) (sql_connect.cc:1349)
==1854==    by 0x755A39: handle_one_connection (sql_connect.cc:1261)

Also reproducible locally for me.



 Comments   
Comment by Elena Stepanova [ 2017-04-28 ]

innodb_fts.create, innodb_fts.innodb-fts-ddl, innodb_fts.innodb_fts_multiple_index, innodb_fts.innodb_fts_stopword_charset, innodb_fts.innodb_fts_misc_1, main.alter_table, innodb_fts.innodb-fts-fic, innodb_fts.innodb_fts_proximity, innodb_fts.innodb_fts_transaction are also affected.

Comment by Elena Stepanova [ 2017-05-07 ]

10.2 doesn't seem to be affected.

Comment by Marko Mäkelä [ 2017-05-19 ]

I can only repeat this in 10.1, not 10.0 or 10.2. It seems to me that the problem resides in code that was originally introduced in MDEV-6812.

Comment by Marko Mäkelä [ 2017-05-23 ]

Before MDEV-6812, it did not matter that merge_files[].offset was uninitialized when no files were created.
This problem was introduced in MDEV-6812. There could be a user-visible impact that the progress reports spit into the error log are bogus.

This could affect 10.2 as well after all, but after MDEV-10509 repeating it could require setting ./mtr -mysqld=-log-warnings=2.

The patch is simple (same for InnoDB and XtraDB):

diff --git a/storage/innobase/row/row0merge.cc b/storage/innobase/row/row0merge.cc
index 9cd79bdd523..85e053de961 100644
--- a/storage/innobase/row/row0merge.cc
+++ b/storage/innobase/row/row0merge.cc
@@ -4035,6 +4035,7 @@ row_merge_build_indexes(
 
 	for (i = 0; i < n_indexes; i++) {
 		merge_files[i].fd = -1;
+		merge_files[i].offset = 0;
 	}
 
 	total_static_cost = COST_BUILD_INDEX_STATIC * n_indexes + COST_READ_CLUSTERED_INDEX;

Generated at Thu Feb 08 07:59:11 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.