MCPcopy Create free account
hub / github.com/FirebirdSQL/firebird / VIO_refetch_record

Function VIO_refetch_record

src/jrd/vio.cpp:3898–3966  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3896
3897
3898bool VIO_refetch_record(thread_db* tdbb, record_param* rpb, jrd_tra* transaction,
3899 bool writelock, bool noundo)
3900{
3901/**************************************
3902 *
3903 * V I O _ r e f e t c h _ r e c o r d
3904 *
3905 **************************************
3906 *
3907 * Functional description
3908 * Refetch & release the record, if we unsure,
3909 * whether information about it is still valid.
3910 *
3911 **************************************/
3912#ifdef VIO_DEBUG
3913 jrd_rel* relation = rpb->rpb_relation;
3914 VIO_trace(DEBUG_READS,
3915 "VIO_refetch_record (rel_id %u, record_param %" QUADFORMAT"d, transaction %" SQUADFORMAT")\n",
3916 relation->rel_id, rpb->rpb_number.getValue(), transaction ? transaction->tra_number : 0);
3917#endif
3918
3919 const TraNumber tid_fetch = rpb->rpb_transaction_nr;
3920
3921 if (!DPM_get(tdbb, rpb, LCK_read) ||
3922 !VIO_chase_record_version(tdbb, rpb, transaction, tdbb->getDefaultPool(), writelock, noundo))
3923 {
3924 if (writelock)
3925 return false;
3926
3927 ERR_post(Arg::Gds(isc_no_cur_rec));
3928 }
3929
3930 if (!(rpb->rpb_runtime_flags & RPB_undo_data))
3931 {
3932 if (rpb->rpb_stream_flags & RPB_s_no_data)
3933 {
3934 CCH_RELEASE(tdbb, &rpb->getWindow(tdbb));
3935 rpb->rpb_address = NULL;
3936 rpb->rpb_length = 0;
3937 }
3938 else
3939 VIO_data(tdbb, rpb, tdbb->getDefaultPool());
3940 }
3941
3942 tdbb->bumpRelStats(RuntimeStatistics::RECORD_RPT_READS, rpb->rpb_relation->rel_id);
3943
3944 // If record is present, and the transaction is read committed,
3945 // make sure the record has not been updated. Also, punt after
3946 // VIO_data() call which will release the page.
3947
3948 if (!writelock &&
3949 (transaction->tra_flags & TRA_read_committed) &&
3950 (tid_fetch != rpb->rpb_transaction_nr) &&
3951 // added to check that it was not current transaction,
3952 // who modified the record. Alex P, 18-Jun-03
3953 (rpb->rpb_transaction_nr != transaction->tra_number) &&
3954 // dimitr: reads using the undo log are also OK
3955 !(rpb->rpb_runtime_flags & RPB_undo_read))

Callers 7

eraseMethod · 0.85
modifyMethod · 0.85
forceWriteLockFunction · 0.85
VIO_eraseFunction · 0.85
VIO_modifyFunction · 0.85
VIO_writelockFunction · 0.85
refetchRecordMethod · 0.85

Calls 10

VIO_traceFunction · 0.85
VIO_chase_record_versionFunction · 0.85
GdsClass · 0.85
CCH_RELEASEFunction · 0.85
VIO_dataFunction · 0.85
Int64Class · 0.85
bumpRelStatsMethod · 0.80
ERR_postFunction · 0.70
getValueMethod · 0.45
getDefaultPoolMethod · 0.45

Tested by

no test coverage detected