Skip to content

Commit

Permalink
Backport fix for bug CORE-1830
Browse files Browse the repository at this point in the history
  • Loading branch information
hvlad committed May 13, 2008
1 parent a456a19 commit c89987f
Showing 1 changed file with 19 additions and 6 deletions.
25 changes: 19 additions & 6 deletions src/jrd/vio.cpp
Expand Up @@ -102,7 +102,7 @@ static void delete_(TDBB, RPB *, SLONG, JrdMemoryPool *);
static UCHAR *delete_tail(TDBB, RPB *, SLONG, UCHAR *, UCHAR *);
static void expunge(TDBB, RPB *, JRD_TRA, SLONG);
static void garbage_collect(TDBB, RPB *, SLONG, LLS);
static void garbage_collect_idx(TDBB, RPB *, RPB *, REC);
static void garbage_collect_idx(TDBB, RPB *, RPB *, REC, REC);
#ifdef GARBAGE_THREAD
static void THREAD_ROUTINE garbage_collector(DBB);
#endif
Expand Down Expand Up @@ -2852,7 +2852,7 @@ void VIO_verb_cleanup(TDBB tdbb, JRD_TRA transaction)
}
update_in_place(tdbb, transaction, &rpb, &new_rpb);
if (!(transaction->tra_flags & TRA_system))
garbage_collect_idx(tdbb, &rpb, &new_rpb, NULL);
garbage_collect_idx(tdbb, &rpb, &new_rpb, NULL, NULL);
rpb.rpb_record = dead_record;
}
}
Expand Down Expand Up @@ -3343,7 +3343,7 @@ static void garbage_collect(

static void garbage_collect_idx(
TDBB tdbb,
RPB * org_rpb, RPB * new_rpb, REC old_data)
RPB * org_rpb, RPB * new_rpb, REC old_data, REC staying_data)
{
/**************************************
*
Expand All @@ -3370,6 +3370,9 @@ static void garbage_collect_idx(
going = staying = NULL;
list_staying(tdbb, org_rpb, &staying);

if (staying_data)
LLS_PUSH(staying_data, &staying);

/* The data that is going is passed either via old_data, or via org_rpb. */

if (old_data)
Expand All @@ -3383,6 +3386,9 @@ static void garbage_collect_idx(

LLS_POP(&going);

if (staying_data)
LLS_POP(&staying);

while (staying)
delete LLS_POP(&staying);
}
Expand Down Expand Up @@ -4678,10 +4684,12 @@ static void verb_post(
}
}
else if (same_tx) {
REC undo = NULL;
if (action->vct_undo && action->vct_undo->locate(Firebird::locEqual, rpb->rpb_number)) {
/* An insert/update followed by a delete is posted to this savepoint,
and this savepoint has already undo for this record. */
action->vct_undo->current().rec_data->rec_flags |= REC_same_tx;
undo = action->vct_undo->current().rec_data;
undo->rec_flags |= REC_same_tx;
}
else {
/* An insert/update followed by a delete is posted to this savepoint,
Expand All @@ -4699,7 +4707,7 @@ static void verb_post(
if (old_data) {
/* The passed old_data will not be used. Thus, garbage collect. */

garbage_collect_idx(tdbb, rpb, new_rpb, old_data);
garbage_collect_idx(tdbb, rpb, new_rpb, old_data, undo);
}
}
else if (old_data) {
Expand All @@ -4708,7 +4716,12 @@ static void verb_post(
so make sure we garbage collect before we loose track of the
in-place-updated record. */

garbage_collect_idx(tdbb, rpb, new_rpb, old_data);
REC undo = NULL;
if (action->vct_undo && action->vct_undo->locate(Firebird::locEqual, rpb->rpb_number)) {
undo = action->vct_undo->current().rec_data;
}

garbage_collect_idx(tdbb, rpb, new_rpb, old_data, undo);
}

tdbb->tdbb_default = old_pool;
Expand Down

0 comments on commit c89987f

Please sign in to comment.