Bug #76774 debug only-code may have side effects in ha_innobase::commit_inplace_alter_table
Submitted: 21 Apr 2015 13:42 Modified: 11 May 2015 13:38
Reporter: Mattias Jonsson Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: InnoDB storage engine Severity:S3 (Non-critical)
Version:5.7 OS:Any
Assigned to: CPU Architecture:Any

[21 Apr 2015 13:42] Mattias Jonsson
Description:
Debug only code sets m_prebuilt, which may alter the behavior from non-debug builds.

How to repeat:
code inspection

Suggested fix:
diff --git a/storage/innobase/handler/handler0alter.cc b/storage/innobase/handle
index a702fea..609a3e7 100644
--- a/storage/innobase/handler/handler0alter.cc
+++ b/storage/innobase/handler/handler0alter.cc
@@ -6884,15 +6884,13 @@ foreign_fail:
        the MDL downgrade. */

 #ifndef DBUG_OFF
-       m_prebuilt = ctx0->prebuilt;
        dict_index_t* clust_index = dict_table_get_first_index(
-               m_prebuilt->table);
+               ctx0->prebuilt->table);
        DBUG_ASSERT(!clust_index->online_log);
        DBUG_ASSERT(dict_index_get_online_status(clust_index)
                    == ONLINE_INDEX_COMPLETE);

-       for (dict_index_t* index = dict_table_get_first_index(
-                    m_prebuilt->table);
+       for (dict_index_t* index = clust_index;
             index;
             index = dict_table_get_next_index(index)) {
                DBUG_ASSERT(!index->to_be_dropped);
[11 May 2015 13:38] Daniel Price
Posted by developer:
 
Fixed as of the upcoming 5.7.8, 5.8.0 releases, and here's the changelog entry:

Debug only code set "m_prebuilt", which may affect in-place "ALTER TABLE"
behaviour. "m_prebuilt" to should not be used to store an intermediate
value in debug-only code.