Commit c126039d authored by unknown's avatar unknown

row0vers.c, row0sel.c:

  Backport the clust rec bug fix from 4.0


innobase/row/row0sel.c:
  Backport the clust rec bug fix from 4.0
innobase/row/row0vers.c:
  Backport the clust rec bug fix from 4.0
parent a18c4883
......@@ -598,7 +598,14 @@ row_sel_get_clust_rec(
clust_rec = btr_pcur_get_rec(&(plan->clust_pcur));
ut_ad(page_rec_is_user_rec(clust_rec));
if (!page_rec_is_user_rec(clust_rec)
|| btr_pcur_get_low_match(&(plan->clust_pcur))
< dict_index_get_n_unique(index)) {
clust_rec = NULL;
goto func_exit;
}
if (!node->read_view) {
/* Try to place a lock on the index record */
......@@ -661,6 +668,7 @@ row_sel_get_clust_rec(
row_sel_fetch_columns(index, clust_rec,
UT_LIST_GET_FIRST(plan->columns));
func_exit:
*out_rec = clust_rec;
return(DB_SUCCESS);
......@@ -2206,7 +2214,17 @@ row_sel_get_clust_rec_for_mysql(
clust_rec = btr_pcur_get_rec(prebuilt->clust_pcur);
ut_ad(page_rec_is_user_rec(clust_rec));
/* Note: only if the search ends up on a non-infimum record is the
low_match value the real match to the search tuple */
if (!page_rec_is_user_rec(clust_rec)
|| btr_pcur_get_low_match(prebuilt->clust_pcur)
< dict_index_get_n_unique(clust_index)) {
clust_rec = NULL;
goto func_exit;
}
if (prebuilt->select_lock_type != LOCK_NONE) {
/* Try to place a lock on the index record */
......@@ -2268,6 +2286,7 @@ row_sel_get_clust_rec_for_mysql(
}
}
func_exit:
*out_rec = clust_rec;
if (prebuilt->select_lock_type == LOCK_X) {
......
......@@ -76,23 +76,9 @@ row_vers_impl_x_locked_off_kernel(
clust_rec = row_get_clust_rec(BTR_SEARCH_LEAF, rec, index,
&clust_index, &mtr);
if (!clust_rec) {
rec_sprintf(err_buf, 900, rec);
ut_print_timestamp(stderr);
fprintf(stderr,
" InnoDB: Error: cannot find the clustered index record\n"
"InnoDB: for a secondary index record in table %s index %s.\n"
"InnoDB: Secondary index record %s.\n"
"InnoDB: The table is probably corrupt. Please run CHECK TABLE on it.\n"
"InnoDB: You can try to repair the table by dump + drop + reimport.\n"
"InnoDB: Send a detailed bug report to mysql@lists.mysql.com.\n",
index->table_name, index->name, err_buf);
mutex_enter(&kernel_mutex);
mtr_commit(&mtr);
/* We assume there is no lock on the record, though this
is not certain because the table is apparently corrupt */
return(NULL);
}
......
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