|  |  | @ -6245,6 +6245,10 @@ alter_fill_stored_column( | 
			
		
	
		
			
				
					|  |  |  | 	} | 
			
		
	
		
			
				
					|  |  |  | } | 
			
		
	
		
			
				
					|  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  | static bool alter_templ_needs_rebuild(const TABLE* altered_table, | 
			
		
	
		
			
				
					|  |  |  |                                       const Alter_inplace_info* ha_alter_info, | 
			
		
	
		
			
				
					|  |  |  |                                       const dict_table_t* table); | 
			
		
	
		
			
				
					|  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  | /** Allows InnoDB to update internal structures with concurrent
 | 
			
		
	
		
			
				
					|  |  |  | writes blocked (provided that check_if_supported_inplace_alter() | 
			
		
	
	
		
			
				
					|  |  | @ -6394,11 +6398,7 @@ ha_innobase::prepare_inplace_alter_table( | 
			
		
	
		
			
				
					|  |  |  | 		    ha_alter_info->key_count)) { | 
			
		
	
		
			
				
					|  |  |  | err_exit_no_heap: | 
			
		
	
		
			
				
					|  |  |  | 		DBUG_ASSERT(m_prebuilt->trx->dict_operation_lock_mode == 0); | 
			
		
	
		
			
				
					|  |  |  | 		if (ha_alter_info->handler_flags & ~INNOBASE_INPLACE_IGNORE) { | 
			
		
	
		
			
				
					|  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  | 			online_retry_drop_indexes( | 
			
		
	
		
			
				
					|  |  |  | 				m_prebuilt->table, m_user_thd); | 
			
		
	
		
			
				
					|  |  |  | 		} | 
			
		
	
		
			
				
					|  |  |  | 		online_retry_drop_indexes(m_prebuilt->table, m_user_thd); | 
			
		
	
		
			
				
					|  |  |  | 		DBUG_RETURN(true); | 
			
		
	
		
			
				
					|  |  |  | 	} | 
			
		
	
		
			
				
					|  |  |  | 
 | 
			
		
	
	
		
			
				
					|  |  | @ -6849,9 +6849,9 @@ err_exit: | 
			
		
	
		
			
				
					|  |  |  | 		== ALTER_OPTIONS | 
			
		
	
		
			
				
					|  |  |  | 		&& !alter_options_need_rebuild(ha_alter_info, table))) { | 
			
		
	
		
			
				
					|  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  | 		ha_innobase_inplace_ctx *ctx = NULL; | 
			
		
	
		
			
				
					|  |  |  | 		if (heap) { | 
			
		
	
		
			
				
					|  |  |  | 			ha_alter_info->handler_ctx | 
			
		
	
		
			
				
					|  |  |  | 				= new ha_innobase_inplace_ctx( | 
			
		
	
		
			
				
					|  |  |  | 			ctx = new ha_innobase_inplace_ctx( | 
			
		
	
		
			
				
					|  |  |  | 					m_prebuilt, | 
			
		
	
		
			
				
					|  |  |  | 					drop_index, n_drop_index, | 
			
		
	
		
			
				
					|  |  |  | 					rename_index, n_rename_index, | 
			
		
	
	
		
			
				
					|  |  | @ -6864,15 +6864,11 @@ err_exit: | 
			
		
	
		
			
				
					|  |  |  | 					 || !thd_is_strict_mode(m_user_thd)), | 
			
		
	
		
			
				
					|  |  |  | 					alt_opt.page_compressed, | 
			
		
	
		
			
				
					|  |  |  | 					alt_opt.page_compression_level); | 
			
		
	
		
			
				
					|  |  |  | 			ha_alter_info->handler_ctx = ctx; | 
			
		
	
		
			
				
					|  |  |  | 		} | 
			
		
	
		
			
				
					|  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  | 		DBUG_ASSERT(m_prebuilt->trx->dict_operation_lock_mode == 0); | 
			
		
	
		
			
				
					|  |  |  | 		if (ha_alter_info->handler_flags & ~(INNOBASE_INPLACE_IGNORE)) { | 
			
		
	
		
			
				
					|  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  | 			online_retry_drop_indexes( | 
			
		
	
		
			
				
					|  |  |  | 				m_prebuilt->table, m_user_thd); | 
			
		
	
		
			
				
					|  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  | 		} | 
			
		
	
		
			
				
					|  |  |  | 		online_retry_drop_indexes(m_prebuilt->table, m_user_thd); | 
			
		
	
		
			
				
					|  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  | 		if ((ha_alter_info->handler_flags | 
			
		
	
		
			
				
					|  |  |  | 		     & ALTER_DROP_VIRTUAL_COLUMN) | 
			
		
	
	
		
			
				
					|  |  | @ -6887,6 +6883,24 @@ err_exit: | 
			
		
	
		
			
				
					|  |  |  | 			DBUG_RETURN(true); | 
			
		
	
		
			
				
					|  |  |  | 		} | 
			
		
	
		
			
				
					|  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  | 		if (!(ha_alter_info->handler_flags & INNOBASE_ALTER_DATA) | 
			
		
	
		
			
				
					|  |  |  | 		    && alter_templ_needs_rebuild(altered_table, ha_alter_info, | 
			
		
	
		
			
				
					|  |  |  | 						 ctx->new_table) | 
			
		
	
		
			
				
					|  |  |  | 		    && ctx->new_table->n_v_cols > 0) { | 
			
		
	
		
			
				
					|  |  |  | 			/* Changing maria record structure may end up here only
 | 
			
		
	
		
			
				
					|  |  |  | 			if virtual columns were altered. In this case, however, | 
			
		
	
		
			
				
					|  |  |  | 			vc_templ should be rebuilt. Since we don't actually | 
			
		
	
		
			
				
					|  |  |  | 			change any stored data, we can just dispose vc_templ; | 
			
		
	
		
			
				
					|  |  |  | 			it will be recreated on next ha_innobase::open(). */ | 
			
		
	
		
			
				
					|  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  | 			DBUG_ASSERT(ctx->new_table == ctx->old_table); | 
			
		
	
		
			
				
					|  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  | 			dict_free_vc_templ(ctx->new_table->vc_templ); | 
			
		
	
		
			
				
					|  |  |  | 			UT_DELETE(ctx->new_table->vc_templ); | 
			
		
	
		
			
				
					|  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  | 			ctx->new_table->vc_templ = NULL; | 
			
		
	
		
			
				
					|  |  |  | 		} | 
			
		
	
		
			
				
					|  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  | 		DBUG_RETURN(false); | 
			
		
	
		
			
				
					|  |  |  | 	} | 
			
		
	
		
			
				
					|  |  |  | 
 | 
			
		
	
	
		
			
				
					|  |  | @ -7000,35 +7014,6 @@ found_col: | 
			
		
	
		
			
				
					|  |  |  | 			    add_fts_doc_id_idx)); | 
			
		
	
		
			
				
					|  |  |  | } | 
			
		
	
		
			
				
					|  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  | /** Check that the column is part of a virtual index(index contains
 | 
			
		
	
		
			
				
					|  |  |  | virtual column) in the table | 
			
		
	
		
			
				
					|  |  |  | @param[in]	table		Table containing column | 
			
		
	
		
			
				
					|  |  |  | @param[in]	col		column to be checked | 
			
		
	
		
			
				
					|  |  |  | @return true if this column is indexed with other virtual columns */ | 
			
		
	
		
			
				
					|  |  |  | static | 
			
		
	
		
			
				
					|  |  |  | bool | 
			
		
	
		
			
				
					|  |  |  | dict_col_in_v_indexes( | 
			
		
	
		
			
				
					|  |  |  | 	dict_table_t*	table, | 
			
		
	
		
			
				
					|  |  |  | 	dict_col_t*	col) | 
			
		
	
		
			
				
					|  |  |  | { | 
			
		
	
		
			
				
					|  |  |  | 	for (dict_index_t* index = dict_table_get_next_index( | 
			
		
	
		
			
				
					|  |  |  | 		dict_table_get_first_index(table)); index != NULL; | 
			
		
	
		
			
				
					|  |  |  | 		index = dict_table_get_next_index(index)) { | 
			
		
	
		
			
				
					|  |  |  | 		if (!dict_index_has_virtual(index)) { | 
			
		
	
		
			
				
					|  |  |  | 			continue; | 
			
		
	
		
			
				
					|  |  |  | 		} | 
			
		
	
		
			
				
					|  |  |  | 		for (ulint k = 0; k < index->n_fields; k++) { | 
			
		
	
		
			
				
					|  |  |  | 			dict_field_t*   field | 
			
		
	
		
			
				
					|  |  |  | 				= dict_index_get_nth_field(index, k); | 
			
		
	
		
			
				
					|  |  |  | 			if (field->col->ind == col->ind) { | 
			
		
	
		
			
				
					|  |  |  | 				return(true); | 
			
		
	
		
			
				
					|  |  |  | 			} | 
			
		
	
		
			
				
					|  |  |  | 		} | 
			
		
	
		
			
				
					|  |  |  | 	} | 
			
		
	
		
			
				
					|  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  | 	return(false); | 
			
		
	
		
			
				
					|  |  |  | } | 
			
		
	
		
			
				
					|  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  | /* Check whether a columnn length change alter operation requires
 | 
			
		
	
		
			
				
					|  |  |  | to rebuild the template. | 
			
		
	
		
			
				
					|  |  |  | @param[in]	altered_table	TABLE object for new version of table. | 
			
		
	
	
		
			
				
					|  |  | @ -7040,9 +7025,9 @@ to rebuild the template. | 
			
		
	
		
			
				
					|  |  |  | static | 
			
		
	
		
			
				
					|  |  |  | bool | 
			
		
	
		
			
				
					|  |  |  | alter_templ_needs_rebuild( | 
			
		
	
		
			
				
					|  |  |  | 	TABLE*                  altered_table, | 
			
		
	
		
			
				
					|  |  |  | 	Alter_inplace_info*     ha_alter_info, | 
			
		
	
		
			
				
					|  |  |  | 	dict_table_t*		table) | 
			
		
	
		
			
				
					|  |  |  | 	const TABLE*            altered_table, | 
			
		
	
		
			
				
					|  |  |  | 	const Alter_inplace_info*     ha_alter_info, | 
			
		
	
		
			
				
					|  |  |  | 	const dict_table_t*		table) | 
			
		
	
		
			
				
					|  |  |  | { | 
			
		
	
		
			
				
					|  |  |  |         ulint	i = 0; | 
			
		
	
		
			
				
					|  |  |  |         List_iterator_fast<Create_field>  cf_it( | 
			
		
	
	
		
			
				
					|  |  | @ -7054,8 +7039,7 @@ alter_templ_needs_rebuild( | 
			
		
	
		
			
				
					|  |  |  | 			for (ulint j=0; j < table->n_cols; j++) { | 
			
		
	
		
			
				
					|  |  |  | 				dict_col_t* cols | 
			
		
	
		
			
				
					|  |  |  |                                    = dict_table_get_nth_col(table, j); | 
			
		
	
		
			
				
					|  |  |  | 				if (cf->length > cols->len | 
			
		
	
		
			
				
					|  |  |  | 				    && dict_col_in_v_indexes(table, cols)) { | 
			
		
	
		
			
				
					|  |  |  | 				if (cf->length > cols->len) { | 
			
		
	
		
			
				
					|  |  |  | 					return(true); | 
			
		
	
		
			
				
					|  |  |  | 				} | 
			
		
	
		
			
				
					|  |  |  | 			} | 
			
		
	
	
		
			
				
					|  |  | 
 |