Commit 4b8304a9 authored by Debarun Banerjee's avatar Debarun Banerjee

BUG#21126772 VALGRIND FAILURE IN ENGINES/FUNCS SUITE

Problem :
---------
This is a regression of bug-19138298. During purge, if
btr_pcur_restore_position fails, we set found_clust to FALSE
so that it can find a possible clustered index record in future
calls for the same undo entry. This, however, overwrites the
old_rec_buf while initializing pcur again in next call.

The leak is reproducible in local environment and with the
test provided along with bug-19138298.

Solution :
----------
If btr_pcur_restore_position() fails close the cursor.
Reviewed-by: default avatarMarko Makela <Marko.Makela@oracle.com>
Reviewed-by: default avatarAnnamalai Gurusami <Annamalai.Gurusami@oracle.com>

RB: 9074
parent 50be523e
...@@ -80,7 +80,7 @@ row_purge_node_create( ...@@ -80,7 +80,7 @@ row_purge_node_create(
/***********************************************************//** /***********************************************************//**
Repositions the pcur in the purge node on the clustered index record, Repositions the pcur in the purge node on the clustered index record,
if found. if found. If the record is not found, close pcur.
@return TRUE if the record was found */ @return TRUE if the record was found */
static static
ibool ibool
...@@ -106,6 +106,11 @@ row_purge_reposition_pcur( ...@@ -106,6 +106,11 @@ row_purge_reposition_pcur(
} }
} }
/* Close the current cursor if we fail to position it correctly. */
if (!node->found_clust) {
btr_pcur_close(&node->pcur);
}
return(node->found_clust); return(node->found_clust);
} }
...@@ -143,8 +148,8 @@ row_purge_remove_clust_if_poss_low( ...@@ -143,8 +148,8 @@ row_purge_remove_clust_if_poss_low(
if (!success) { if (!success) {
/* The record is already removed */ /* The record is already removed */
/* Persistent cursor is closed if reposition fails. */
btr_pcur_commit_specify_mtr(pcur, &mtr); mtr_commit(&mtr);
return(TRUE); return(TRUE);
} }
...@@ -258,7 +263,12 @@ row_purge_poss_sec( ...@@ -258,7 +263,12 @@ row_purge_poss_sec(
btr_pcur_get_rec(&node->pcur), btr_pcur_get_rec(&node->pcur),
&mtr, index, entry); &mtr, index, entry);
btr_pcur_commit_specify_mtr(&node->pcur, &mtr); /* Persistent cursor is closed if reposition fails. */
if (node->found_clust) {
btr_pcur_commit_specify_mtr(&node->pcur, &mtr);
} else {
mtr_commit(&mtr);
}
return(can_delete); return(can_delete);
} }
......
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