Commit e5991403 authored by Debarun Banerjee's avatar Debarun Banerjee

BUG#21065746 RQG_PARTN_PRUNING_VALGRIND FAILED IN REM0REC.CC

Problem :
---------
This is a regression of Bug#19138298. In purge_node_t::validate_pcur
we are trying to get offsets for all columns of clustered index from
stored record in persistent cursor. This would fail when stored record
is not having all fields of the index. The stored record stores only
fields that are needed to uniquely identify the entry.

Solution :
----------
1. Use pcur.old_n_fields to get fields that are stored
2. Add comment to note dependency between stored fields in purge node
ref and stored cursor.
3. Return if the cursor record is not already stored as it is not safe
to access cursor record directly without latch.
Reviewed-by: default avatarMarko Makela <marko.makela@oracle.com>

RB: 9139
parent 4b8304a9
......@@ -823,12 +823,12 @@ Validate the persisent cursor in the purge node. The purge node has two
references to the clustered index record - one via the ref member, and the
other via the persistent cursor. These two references must match each
other if the found_clust flag is set.
@return true if the persistent cursor is consistent with the ref member.*/
@return true if the stored copy of persistent cursor is consistent
with the ref member.*/
ibool
row_purge_validate_pcur(
purge_node_t* node)
{
const rec_t* rec ;
dict_index_t* clust_index;
ulint* offsets;
int st;
......@@ -841,23 +841,25 @@ row_purge_validate_pcur(
return(TRUE);
}
clust_index = node->pcur.btr_cur.index;
if (node->pcur.old_stored == BTR_PCUR_OLD_STORED) {
rec = node->pcur.old_rec;
} else {
rec = btr_pcur_get_rec(&node->pcur);
if (node->pcur.old_stored != BTR_PCUR_OLD_STORED) {
return(TRUE);
}
offsets = rec_get_offsets(rec,
clust_index, NULL, ULINT_UNDEFINED, &node->heap);
clust_index = node->pcur.btr_cur.index;
offsets = rec_get_offsets(node->pcur.old_rec, clust_index, NULL,
node->pcur.old_n_fields, &node->heap);
st = cmp_dtuple_rec(node->ref, rec, offsets);
/* Here we are comparing the purge ref record and the stored initial
part in persistent cursor. Both cases we store n_uniq fields of the
cluster index and so it is fine to do the comparison. We note this
dependency here as pcur and ref belong to different modules. */
st = cmp_dtuple_rec(node->ref, node->pcur.old_rec, offsets);
if (st != 0) {
fprintf(stderr, "Purge node pcur validation failed\n");
dtuple_print(stderr, node->ref);
rec_print(stderr, rec, clust_index);
rec_print(stderr, node->pcur.old_rec, clust_index);
return(FALSE);
}
......
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