Skip to content
Permalink
Browse files
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().
  • Loading branch information
dr-m committed Sep 18, 2018
1 parent 159b41b commit 043639f
Showing 1 changed file with 6 additions and 13 deletions.
@@ -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;
}

0 comments on commit 043639f

Please sign in to comment.