Subject | Re: [IB-Architect] Records inserted and deleted in same transaction |
---|---|
Author | Ann Harrison |
Post date | 2000-09-06T14:18:13Z |
At 08:25 PM 9/5/00 -0700, Jason Wharton wrote:
the garbage collect phase is when the record actually goes away.
Here's the code (and a rare comment) from VIO_modify.
/* We're almost ready to go. To modify the record, we must first
make a copy of the old record someplace else. Then we must re-fetch
the record (for write) and verify that it is legal for us to
modify it -- that it was written by a transaction that was committed
when we started. If not, the transaction that wrote the record
is either active, dead, or in limbo. If the transaction is active,
wait for it to finish. If it commits, we can't proceed and must
return an update conflict. If the transaction is dead, back out the
old version of the record and try again. If in limbo, punt. */
if (org_rpb->rpb_transaction == transaction->tra_number &&
org_rpb->rpb_format_number == new_rpb->rpb_format_number)
{
update_in_place (tdbb, transaction, org_rpb, new_rpb);
if (!(transaction->tra_flags & TRA_system) &&
(transaction->tra_save_point) &&
(transaction->tra_save_point->sav_verb_count))
verb_post (tdbb, transaction, org_rpb, org_rpb->rpb_undo, new_rpb,
FALSE, FALSE);
return;
}
stack = NULL;
prepare_update (tdbb, transaction, org_rpb->rpb_transaction, org_rpb, &temp,
new_rpb, &stack);
Regards,
Ann
>How efficiently does InterBase handle the case mentioned above?Reasonably efficiently. A delete is actually a kind of modify -
the garbage collect phase is when the record actually goes away.
Here's the code (and a rare comment) from VIO_modify.
/* We're almost ready to go. To modify the record, we must first
make a copy of the old record someplace else. Then we must re-fetch
the record (for write) and verify that it is legal for us to
modify it -- that it was written by a transaction that was committed
when we started. If not, the transaction that wrote the record
is either active, dead, or in limbo. If the transaction is active,
wait for it to finish. If it commits, we can't proceed and must
return an update conflict. If the transaction is dead, back out the
old version of the record and try again. If in limbo, punt. */
if (org_rpb->rpb_transaction == transaction->tra_number &&
org_rpb->rpb_format_number == new_rpb->rpb_format_number)
{
update_in_place (tdbb, transaction, org_rpb, new_rpb);
if (!(transaction->tra_flags & TRA_system) &&
(transaction->tra_save_point) &&
(transaction->tra_save_point->sav_verb_count))
verb_post (tdbb, transaction, org_rpb, org_rpb->rpb_undo, new_rpb,
FALSE, FALSE);
return;
}
stack = NULL;
prepare_update (tdbb, transaction, org_rpb->rpb_transaction, org_rpb, &temp,
new_rpb, &stack);
Regards,
Ann