Commit 8250cec9 authored by Marko Mäkelä's avatar Marko Mäkelä

ha_innobase_inplace_ctx::prepare_instant(): Swap with the correct column

parent cf703bc5
...@@ -365,15 +365,20 @@ struct ha_innobase_inplace_ctx : public inplace_alter_handler_ctx ...@@ -365,15 +365,20 @@ struct ha_innobase_inplace_ctx : public inplace_alter_handler_ctx
sizeof(dict_instant_t))) sizeof(dict_instant_t)))
dict_instant_t(); dict_instant_t();
instant_table->instant->n_dropped = n_drop; instant_table->instant->n_dropped = n_drop;
instant_table->instant->dropped if (n_drop) {
= static_cast<dict_col_t*>( instant_table->instant->dropped
mem_heap_alloc(instant_table->heap, = static_cast<dict_col_t*>(
n_drop mem_heap_alloc(
* sizeof(dict_col_t))); instant_table->heap,
if (n_old_drop) { n_drop
memcpy(instant_table->instant->dropped, * sizeof(dict_col_t)));
old_table->instant->dropped, if (n_old_drop) {
n_old_drop * sizeof(dict_col_t)); memcpy(instant_table->instant->dropped,
old_table->instant->dropped,
n_old_drop * sizeof(dict_col_t));
}
} else {
instant_table->instant->dropped = NULL;
} }
unsigned d = n_old_drop; unsigned d = n_old_drop;
...@@ -446,10 +451,23 @@ struct ha_innobase_inplace_ctx : public inplace_alter_handler_ctx ...@@ -446,10 +451,23 @@ struct ha_innobase_inplace_ctx : public inplace_alter_handler_ctx
!= col_ind) { != col_ind) {
/* The fields for instantly /* The fields for instantly
added columns must be placed added columns must be placed
last in the clustered index. */ last in the clustered index.
Keep pre-existing fields in
the same position. */
uint k;
for (k = j + 1;
k < instant->n_fields;
k++) {
if (instant->fields[k]
.col->ind
== col_ind) {
goto found_j;
}
}
DBUG_ASSERT(!"no such col");
found_j:
std::swap(instant->fields[j], std::swap(instant->fields[j],
instant->fields[ instant->fields[k]);
j + 1]);
} }
DBUG_ASSERT(instant->fields[j].col->ind DBUG_ASSERT(instant->fields[j].col->ind
== col_ind); == col_ind);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment