mirror of
https://github.com/MariaDB/server.git
synced 2025-07-29 05:21:33 +03:00
MDEV-13818: Revert an incorrect change
In commit d30f17af49
the change of
the loop iteration broke another error handling path that did
"goto error_handling_drop_uncached". Cover this code path with
fault injection, and revert to the correct iteration.
There are two fault injection labels innodb_OOM_prepare_inplace_alter.
Their order was swapped in MDEV-11369, so that the label that used
to be covered in an ADD INDEX code path would become unreachable
because the label that is executed for any ALTER TABLE was executed
first. Let us introduce the label innodb_OOM_prepare_add_index
for the more specific case.
This commit is contained in:
@ -43,6 +43,10 @@ SET DEBUG_DBUG = '+d,innodb_OOM_inplace_alter';
|
|||||||
CREATE UNIQUE INDEX c2 ON t1(c2);
|
CREATE UNIQUE INDEX c2 ON t1(c2);
|
||||||
ERROR HY000: Out of memory.
|
ERROR HY000: Out of memory.
|
||||||
SET DEBUG_DBUG = @saved_debug_dbug;
|
SET DEBUG_DBUG = @saved_debug_dbug;
|
||||||
|
SET DEBUG_DBUG = '+d,innodb_OOM_prepare_add_index';
|
||||||
|
ALTER TABLE t1 ADD KEY(c2), ADD KEY c3_10(c3(10)), ADD KEY c3_c2(c3(4),c2);
|
||||||
|
ERROR HY000: Out of memory.
|
||||||
|
SET DEBUG_DBUG = @saved_debug_dbug;
|
||||||
CREATE UNIQUE INDEX c2 ON t1(c2);
|
CREATE UNIQUE INDEX c2 ON t1(c2);
|
||||||
DROP INDEX c2 ON t1;
|
DROP INDEX c2 ON t1;
|
||||||
connection default;
|
connection default;
|
||||||
|
@ -53,6 +53,10 @@ SET DEBUG_DBUG = '+d,innodb_OOM_inplace_alter';
|
|||||||
--error ER_OUT_OF_RESOURCES
|
--error ER_OUT_OF_RESOURCES
|
||||||
CREATE UNIQUE INDEX c2 ON t1(c2);
|
CREATE UNIQUE INDEX c2 ON t1(c2);
|
||||||
SET DEBUG_DBUG = @saved_debug_dbug;
|
SET DEBUG_DBUG = @saved_debug_dbug;
|
||||||
|
SET DEBUG_DBUG = '+d,innodb_OOM_prepare_add_index';
|
||||||
|
--error ER_OUT_OF_RESOURCES
|
||||||
|
ALTER TABLE t1 ADD KEY(c2), ADD KEY c3_10(c3(10)), ADD KEY c3_c2(c3(4),c2);
|
||||||
|
SET DEBUG_DBUG = @saved_debug_dbug;
|
||||||
CREATE UNIQUE INDEX c2 ON t1(c2);
|
CREATE UNIQUE INDEX c2 ON t1(c2);
|
||||||
DROP INDEX c2 ON t1;
|
DROP INDEX c2 ON t1;
|
||||||
|
|
||||||
|
@ -5659,11 +5659,9 @@ index_created:
|
|||||||
if (index) {
|
if (index) {
|
||||||
dict_mem_index_free(index);
|
dict_mem_index_free(index);
|
||||||
}
|
}
|
||||||
a++;
|
|
||||||
error_handling_drop_uncached:
|
error_handling_drop_uncached:
|
||||||
while (a < ctx->num_to_add_index) {
|
while (++a < ctx->num_to_add_index) {
|
||||||
dict_mem_index_free(
|
dict_mem_index_free(ctx->add_index[a]);
|
||||||
ctx->add_index[a++]);
|
|
||||||
}
|
}
|
||||||
goto error_handling;
|
goto error_handling;
|
||||||
} else {
|
} else {
|
||||||
@ -5693,10 +5691,6 @@ error_handling_drop_uncached:
|
|||||||
/* No need to allocate a modification log. */
|
/* No need to allocate a modification log. */
|
||||||
DBUG_ASSERT(!index->online_log);
|
DBUG_ASSERT(!index->online_log);
|
||||||
} else {
|
} else {
|
||||||
DBUG_EXECUTE_IF(
|
|
||||||
"innodb_OOM_prepare_inplace_alter",
|
|
||||||
error = DB_OUT_OF_MEMORY;
|
|
||||||
goto error_handling_drop_uncached;);
|
|
||||||
rw_lock_x_lock(&ctx->add_index[a]->lock);
|
rw_lock_x_lock(&ctx->add_index[a]->lock);
|
||||||
|
|
||||||
bool ok = row_log_allocate(
|
bool ok = row_log_allocate(
|
||||||
@ -5708,6 +5702,14 @@ error_handling_drop_uncached:
|
|||||||
|
|
||||||
rw_lock_x_unlock(&index->lock);
|
rw_lock_x_unlock(&index->lock);
|
||||||
|
|
||||||
|
DBUG_EXECUTE_IF(
|
||||||
|
"innodb_OOM_prepare_add_index",
|
||||||
|
if (ok && a == 1) {
|
||||||
|
row_log_free(
|
||||||
|
index->online_log);
|
||||||
|
ok = false;
|
||||||
|
});
|
||||||
|
|
||||||
if (!ok) {
|
if (!ok) {
|
||||||
error = DB_OUT_OF_MEMORY;
|
error = DB_OUT_OF_MEMORY;
|
||||||
goto error_handling_drop_uncached;
|
goto error_handling_drop_uncached;
|
||||||
|
Reference in New Issue
Block a user