8
0
mirror of https://github.com/FirebirdSQL/firebird.git synced 2025-01-24 06:03:02 +01:00

Backport fix for bug CORE-1830

This commit is contained in:
hvlad 2008-05-13 08:04:03 +00:00
parent d64708693a
commit 3156defb7d

View File

@ -101,7 +101,7 @@ static void expunge(thread_db*, record_param*, const jrd_tra*, SLONG);
static bool dfw_should_know(record_param* org_rpb, record_param* new_rpb,
USHORT irrelevant_field, bool void_update_is_relevant = false);
static void garbage_collect(thread_db*, record_param*, SLONG, RecordStack&);
static void garbage_collect_idx(thread_db*, record_param*, record_param*, Record*);
static void garbage_collect_idx(thread_db*, record_param*, record_param*, Record*, Record*);
#ifdef GARBAGE_THREAD
static THREAD_ENTRY_DECLARE garbage_collector(THREAD_ENTRY_PARAM);
#endif
@ -3107,7 +3107,7 @@ void VIO_verb_cleanup(thread_db* 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;
}
@ -3790,7 +3790,7 @@ static void garbage_collect(thread_db* tdbb,
static void garbage_collect_idx(
thread_db* tdbb,
record_param* org_rpb, record_param* new_rpb,
Record* old_data)
Record* old_data, Record* staying_data)
{
/**************************************
*
@ -3814,6 +3814,10 @@ static void garbage_collect_idx(
RecordStack going, staying;
list_staying(tdbb, org_rpb, staying);
if (staying_data) {
staying.push(staying_data);
}
/* The data that is going is passed either via old_data, or via org_rpb. */
@ -3825,6 +3829,9 @@ static void garbage_collect_idx(
going.pop();
if (staying_data) {
staying.pop();
}
clearRecordStack(staying);
}
@ -5164,10 +5171,12 @@ static void verb_post(
}
}
else if (same_tx) {
Record* undo = NULL;
if (action->vct_undo && action->vct_undo->locate(rpb->rpb_number.getValue())) {
/* 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,
@ -5186,7 +5195,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) {
@ -5195,6 +5204,10 @@ static void verb_post(
so make sure we garbage collect before we lose track of the
in-place-updated record. */
garbage_collect_idx(tdbb, rpb, new_rpb, old_data);
Record* undo = NULL;
if (action->vct_undo && action->vct_undo->locate(rpb->rpb_number.getValue())) {
undo = action->vct_undo->current().rec_data;
}
garbage_collect_idx(tdbb, rpb, new_rpb, old_data, undo);
}
}