Commit 043639f9 authored by Marko Mäkelä's avatar Marko Mäkelä

Simplify innobase_add_instant_try()

Remove some code duplication and dead code. If no 'default row'
record exists, the root page must be in the conventional format.
Should the page type already be FIL_PAGE_TYPE_INSTANT, we would
necessarily hit a debug assertion failure in page_set_instant().
parent 159b41b8
......@@ -4441,8 +4441,8 @@ innobase_add_instant_try(
ut_ad(page_is_root(block->frame));
btr_page_empty(block, NULL, index, 0, &mtr);
index->remove_instant();
mtr.commit();
return false;
err = DB_SUCCESS;
goto func_exit;
}
/* Convert the table to the instant ADD COLUMN format. */
......@@ -4451,20 +4451,12 @@ innobase_add_instant_try(
mtr.start();
index->set_modified(mtr);
if (page_t* root = btr_root_get(index, &mtr)) {
switch (fil_page_get_type(root)) {
case FIL_PAGE_TYPE_INSTANT:
DBUG_ASSERT(page_get_instant(root)
== index->n_core_fields);
break;
case FIL_PAGE_INDEX:
DBUG_ASSERT(!page_is_comp(root)
|| !page_get_instant(root));
break;
default:
if (fil_page_get_type(root) != FIL_PAGE_INDEX) {
DBUG_ASSERT(!"wrong page type");
goto func_exit;
goto err_exit;
}
DBUG_ASSERT(!page_is_comp(root) || !page_get_instant(root));
mlog_write_ulint(root + FIL_PAGE_TYPE,
FIL_PAGE_TYPE_INSTANT, MLOG_2BYTES,
&mtr);
......@@ -4476,6 +4468,7 @@ innobase_add_instant_try(
BTR_NO_LOCKING_FLAG, BTR_MODIFY_TREE, index,
index->n_uniq, entry, 0, thr, false);
} else {
err_exit:
err = DB_CORRUPTION;
}
......
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