8
0
mirror of https://github.com/FirebirdSQL/firebird.git synced 2025-01-23 22:43:04 +01:00

Update VIO_DEBUG code - mostly added relation id.

This commit is contained in:
hvlad 2018-05-30 16:38:01 +03:00
parent a106ac4345
commit 45bbbe2157
4 changed files with 161 additions and 102 deletions

View File

@ -94,7 +94,8 @@ RelationPages* jrd_rel::getPagesInternal(thread_db* tdbb, TraNumber tran, bool a
#ifdef VIO_DEBUG
VIO_trace(DEBUG_WRITES,
"jrd_rel::getPages inst %" ULONGFORMAT", ppp %" SLONGFORMAT", irp %" SLONGFORMAT", addr 0x%x\n",
"jrd_rel::getPages rel_id %u, inst %" SQUADFORMAT", ppp %" SLONGFORMAT", irp %" SLONGFORMAT", addr 0x%x\n",
rel_id,
newPages->rel_instance_id,
newPages->rel_pages ? (*newPages->rel_pages)[0] : 0,
newPages->rel_index_root,
@ -129,7 +130,8 @@ RelationPages* jrd_rel::getPagesInternal(thread_db* tdbb, TraNumber tran, bool a
#ifdef VIO_DEBUG
VIO_trace(DEBUG_WRITES,
"jrd_rel::getPages inst %" SQUADFORMAT", irp %" SLONGFORMAT", idx %u, idx_root %" SLONGFORMAT", addr 0x%x\n",
"jrd_rel::getPages rel_id %u, inst %" SQUADFORMAT", irp %" SLONGFORMAT", idx %u, idx_root %" SLONGFORMAT", addr 0x%x\n",
rel_id,
newPages->rel_instance_id,
newPages->rel_index_root,
idx->idx_id,
@ -167,7 +169,8 @@ bool jrd_rel::delPages(thread_db* tdbb, TraNumber tran, RelationPages* aPages)
#ifdef VIO_DEBUG
VIO_trace(DEBUG_WRITES,
"jrd_rel::delPages inst %" ULONGFORMAT", ppp %" SLONGFORMAT", irp %" SLONGFORMAT", addr 0x%x\n",
"jrd_rel::delPages rel_id %u, inst %" SQUADFORMAT", ppp %" SLONGFORMAT", irp %" SLONGFORMAT", addr 0x%x\n",
rel_id,
pages->rel_instance_id,
pages->rel_pages ? (*pages->rel_pages)[0] : 0,
pages->rel_index_root,

View File

@ -149,8 +149,10 @@ void DPM_backout( thread_db* tdbb, record_param* rpb)
CHECK_DBB(dbb);
#ifdef VIO_DEBUG
jrd_rel* relation = rpb->rpb_relation;
VIO_trace(DEBUG_WRITES,
"DPM_backout (record_param %" QUADFORMAT"d)\n", rpb->rpb_number.getValue());
"DPM_backout (rel_id %u, record_param %" QUADFORMAT"d)\n",
relation->rel_id, rpb->rpb_number.getValue());
VIO_trace(DEBUG_WRITES_INFO,
" record %" ULONGFORMAT":%d transaction %" ULONGFORMAT" back %"
@ -339,9 +341,10 @@ bool DPM_chain( thread_db* tdbb, record_param* org_rpb, record_param* new_rpb)
CHECK_DBB(dbb);
#ifdef VIO_DEBUG
jrd_rel* relation = org_rpb->rpb_relation;
VIO_trace(DEBUG_WRITES,
"DPM_chain (org_rpb %" QUADFORMAT"d, new_rpb %"
QUADFORMAT"d)\n", org_rpb->rpb_number.getValue(),
"DPM_chain (rel_id %u, org_rpb %" QUADFORMAT"d, new_rpb %" QUADFORMAT"d)\n",
relation->rel_id, org_rpb->rpb_number.getValue(),
new_rpb ? new_rpb->rpb_number.getValue() : 0);
VIO_trace(DEBUG_WRITES_INFO,
@ -509,6 +512,15 @@ bool DPM_chain( thread_db* tdbb, record_param* org_rpb, record_param* new_rpb)
if (fill)
memset(data + size, 0, fill);
#ifdef VIO_DEBUG
VIO_trace(DEBUG_WRITES_INFO,
" new record %" ULONGFORMAT":%d transaction %" ULONGFORMAT
" back %" ULONGFORMAT":%d fragment %" ULONGFORMAT":%d flags %d\n",
new_rpb->rpb_page, new_rpb->rpb_line, new_rpb->rpb_transaction_nr,
new_rpb->rpb_b_page, new_rpb->rpb_b_line, new_rpb->rpb_f_page,
new_rpb->rpb_f_line, new_rpb->rpb_flags);
#endif
if (page->dpg_header.pag_flags & dpg_swept)
{
page->dpg_header.pag_flags &= ~dpg_swept;
@ -687,6 +699,7 @@ void DPM_delete( thread_db* tdbb, record_param* rpb, ULONG prior_page)
CHECK_DBB(dbb);
#ifdef VIO_DEBUG
jrd_rel* relation = rpb->rpb_relation;
VIO_trace(DEBUG_WRITES,
"DPM_delete (record_param %" QUADFORMAT", prior_page %" ULONGFORMAT")\n",
rpb->rpb_number.getValue(), prior_page);
@ -1015,7 +1028,8 @@ void DPM_delete_relation_pages(Jrd::thread_db* tdbb, Jrd::jrd_rel* relation,
#ifdef VIO_DEBUG
VIO_trace(DEBUG_TRACE_ALL,
"DPM_delete_relation (relation %d)\n", relation->rel_id);
"DPM_delete_relation_pages (relation %d, instance %" SQUADFORMAT")\n",
relation->rel_id, relPages->rel_instance_id);
#endif
// Delete all data and pointer pages
@ -1107,9 +1121,10 @@ bool DPM_fetch(thread_db* tdbb, record_param* rpb, USHORT lock)
SET_TDBB(tdbb);
#ifdef VIO_DEBUG
jrd_rel* relation = rpb->rpb_relation;
VIO_trace(DEBUG_READS,
"DPM_fetch (record_param %" QUADFORMAT"d, lock %d)\n",
rpb->rpb_number.getValue(), lock);
"DPM_fetch (rel_id %u, record_param %" QUADFORMAT"d, lock %d)\n",
relation->rel_id, rpb->rpb_number.getValue(), lock);
VIO_trace(DEBUG_READS_INFO,
" record %" ULONGFORMAT":%d\n", rpb->rpb_page, rpb->rpb_line);
@ -1169,9 +1184,10 @@ bool DPM_fetch_back(thread_db* tdbb, record_param* rpb, USHORT lock, SSHORT latc
SET_TDBB(tdbb);
#ifdef VIO_DEBUG
jrd_rel* relation = rpb->rpb_relation;
VIO_trace(DEBUG_READS,
"DPM_fetch_back (record_param %" QUADFORMAT"d, lock %d)\n",
rpb->rpb_number.getValue(), lock);
"DPM_fetch_back (rel_id %u, record_param %" QUADFORMAT"d, lock %d)\n",
relation->rel_id, rpb->rpb_number.getValue(), lock);
VIO_trace(DEBUG_READS_INFO,
" record %" ULONGFORMAT":%d transaction %" ULONGFORMAT
@ -1233,9 +1249,10 @@ void DPM_fetch_fragment( thread_db* tdbb, record_param* rpb, USHORT lock)
SET_TDBB(tdbb);
#ifdef VIO_DEBUG
jrd_rel* relation = rpb->rpb_relation;
VIO_trace(DEBUG_READS,
"DPM_fetch_fragment (record_param %" QUADFORMAT"d, lock %d)\n",
rpb->rpb_number.getValue(), lock);
"DPM_fetch_fragment (rel_id %u, record_param %" QUADFORMAT"d, lock %d)\n",
relation->rel_id, rpb->rpb_number.getValue(), lock);
VIO_trace(DEBUG_READS_INFO,
" record %" ULONGFORMAT":%d transaction %" ULONGFORMAT
@ -1398,9 +1415,10 @@ bool DPM_get(thread_db* tdbb, record_param* rpb, SSHORT lock_type)
CHECK_DBB(dbb);
#ifdef VIO_DEBUG
jrd_rel* relation = rpb->rpb_relation;
VIO_trace(DEBUG_READS,
"DPM_get (record_param %" QUADFORMAT"d, lock type %d)\n",
rpb->rpb_number.getValue(), lock_type);
"DPM_get (rel_id %u, record_param %" QUADFORMAT"d, lock type %d)\n",
relation->rel_id, rpb->rpb_number.getValue(), lock_type);
#endif
WIN* window = &rpb->getWindow(tdbb);
@ -1501,10 +1519,11 @@ ULONG DPM_get_blob(thread_db* tdbb,
rpb.getWindow(tdbb).win_flags = WIN_secondary;
#ifdef VIO_DEBUG
jrd_rel* relation = blob->blb_relation;
VIO_trace(DEBUG_READS,
"DPM_get_blob (blob, record_number %" QUADFORMAT
"DPM_get_blob (rel_id %u, blob, record_number %" QUADFORMAT
"d, delete_flag %d, prior_page %" ULONGFORMAT")\n",
record_number.getValue(), (int) delete_flag, prior_page);
relation->rel_id, record_number.getValue(), (int)delete_flag, prior_page);
#endif
// Find starting point
@ -1620,8 +1639,10 @@ bool DPM_next(thread_db* tdbb, record_param* rpb, USHORT lock_type, bool onepage
CHECK_DBB(dbb);
#ifdef VIO_DEBUG
jrd_rel* relation = rpb->rpb_relation;
VIO_trace(DEBUG_READS,
"DPM_next (record_param %" QUADFORMAT"d)\n", rpb->rpb_number.getValue());
"DPM_next (rel_id %u, record_param %" QUADFORMAT"d)\n",
relation->rel_id, rpb->rpb_number.getValue());
#endif
WIN* window = &rpb->getWindow(tdbb);
@ -1648,7 +1669,7 @@ bool DPM_next(thread_db* tdbb, record_param* rpb, USHORT lock_type, bool onepage
#ifdef VIO_DEBUG
VIO_trace(DEBUG_READS_INFO,
" pointer, slot, and line %d:%d%d\n", pp_sequence, slot, line);
" sequence, slot, and line %" ULONGFORMAT" %" ULONGFORMAT":%d\n", pp_sequence, slot, line);
#endif
// If I'm a sweeper I don't need to look at swept pages. Also I should
@ -2037,9 +2058,10 @@ void DPM_store( thread_db* tdbb, record_param* rpb, PageStack& stack, const Jrd:
CHECK_DBB(dbb);
#ifdef VIO_DEBUG
jrd_rel* relation = rpb->rpb_relation;
VIO_trace(DEBUG_WRITES,
"DPM_store (record_param %" QUADFORMAT"d, stack, type %d)\n",
rpb->rpb_number.getValue(), type);
"DPM_store (rel_id %u, record_param %" QUADFORMAT"d, stack, type %d)\n",
relation->rel_id, rpb->rpb_number.getValue(), type);
VIO_trace(DEBUG_WRITES_INFO,
" record to store %" ULONGFORMAT":%d transaction %" ULONGFORMAT
@ -2122,8 +2144,10 @@ RecordNumber DPM_store_blob(thread_db* tdbb, blb* blob, Record* record)
CHECK_DBB(dbb);
#ifdef VIO_DEBUG
jrd_rel* relation = blob->blb_relation;
VIO_trace(DEBUG_WRITES,
"DPM_store_blob (blob, record)\n");
"DPM_store_blob (rel_id %u, blob, record)\n",
relation->rel_id);
#endif
// Figure out length of blob on page. Remember that blob can either
@ -2190,8 +2214,10 @@ void DPM_rewrite_header( thread_db* tdbb, record_param* rpb)
CHECK_DBB(dbb);
#ifdef VIO_DEBUG
jrd_rel* relation = rpb->rpb_relation;
VIO_trace(DEBUG_WRITES,
"DPM_rewrite_header (record_param %" QUADFORMAT"d)\n", rpb->rpb_number.getValue());
"DPM_rewrite_header (rel_id %u, record_param %" QUADFORMAT"d)\n",
relation->rel_id, rpb->rpb_number.getValue());
VIO_trace(DEBUG_WRITES_INFO,
" record %" ULONGFORMAT":%d\n", rpb->rpb_page, rpb->rpb_line);
@ -2243,9 +2269,10 @@ void DPM_update( thread_db* tdbb, record_param* rpb, PageStack* stack, const jrd
CHECK_DBB(dbb);
#ifdef VIO_DEBUG
jrd_rel* relation = rpb->rpb_relation;
VIO_trace(DEBUG_WRITES,
"DPM_update (record_param %" QUADFORMAT"d, stack, transaction %" ULONGFORMAT")\n",
rpb->rpb_number.getValue(), transaction ? transaction->tra_number : 0);
"DPM_update (rel_id %u, record_param %" QUADFORMAT"d, stack, transaction %" ULONGFORMAT")\n",
relation->rel_id, rpb->rpb_number.getValue(), transaction ? transaction->tra_number : 0);
VIO_trace(DEBUG_WRITES_INFO,
" record %" ULONGFORMAT":%d transaction %" ULONGFORMAT" back %"
@ -2614,10 +2641,11 @@ static void fragment(thread_db* tdbb,
CHECK_DBB(dbb);
#ifdef VIO_DEBUG
jrd_rel* relation = rpb->rpb_relation;
VIO_trace(DEBUG_WRITES,
"fragment (record_param %" QUADFORMAT
"fragment (rel_id %u, record_param %" QUADFORMAT
"d, available_space %d, dcc, length %d, transaction %" ULONGFORMAT")\n",
rpb->rpb_number.getValue(), available_space, length,
relation->rel_id, rpb->rpb_number.getValue(), available_space, length,
transaction ? transaction->tra_number : 0);
VIO_trace(DEBUG_WRITES_INFO,
@ -2789,7 +2817,8 @@ static void extend_relation(thread_db* tdbb, jrd_rel* relation, WIN* window, con
#ifdef VIO_DEBUG
VIO_trace(DEBUG_WRITES_INFO,
" extend_relation (relation %d, window)\n", relation->rel_id);
" extend_relation (relation %d, instance %" SQUADFORMAT", window)\n",
relation->rel_id, relPages->rel_instance_id);
#endif
// Search pointer pages for an empty slot.
@ -3438,9 +3467,10 @@ static void mark_full(thread_db* tdbb, record_param* rpb)
Database* dbb = tdbb->getDatabase();
CHECK_DBB(dbb);
jrd_rel* relation = rpb->rpb_relation;
#ifdef VIO_DEBUG
VIO_trace(DEBUG_TRACE_ALL,
"mark_full ()\n");
"mark_full (rel_id %u)\n", relation->rel_id);
#endif
// We need to access the pointer page for write. To avoid deadlocks,
@ -3452,7 +3482,6 @@ static void mark_full(thread_db* tdbb, record_param* rpb)
const ULONG sequence = dpage->dpg_sequence;
CCH_RELEASE(tdbb, &rpb->getWindow(tdbb));
jrd_rel* relation = rpb->rpb_relation;
RelationPages* relPages = relation->getPages(tdbb);
WIN pp_window(relPages->rel_pg_space_id, -1);
@ -3598,8 +3627,10 @@ static void store_big_record(thread_db* tdbb,
CHECK_DBB(dbb);
#ifdef VIO_DEBUG
jrd_rel* relation = rpb->rpb_relation;
VIO_trace(DEBUG_TRACE_ALL,
"store_big_record ()\n");
"store_big_record (rel_id %u, record %" SQUADFORMAT")\n",
relation->rel_id, rpb->rpb_number.getValue());
#endif
// Start compression from the end.
@ -3675,7 +3706,7 @@ static void store_big_record(thread_db* tdbb,
" back portion\n");
VIO_trace(DEBUG_WRITES_INFO,
" getWindow(tdbb) page %" ULONGFORMAT
" window page %" ULONGFORMAT
", max_data %d, \n\trhdf_flags %d, prior %" ULONGFORMAT"\n",
rpb->getWindow(tdbb).win_page.getPageNum(), max_data, header->rhdf_flags,
prior.getPageNum());

View File

@ -644,7 +644,7 @@ PAG PAG_allocate_pages(thread_db* tdbb, WIN* window, int cntAlloc, bool aligned)
#ifdef VIO_DEBUG
VIO_trace(DEBUG_WRITES_INFO,
"\tPAG_allocate: allocated page %" SLONGFORMAT"\n",
"PAG_allocate: allocated page %" SLONGFORMAT"\n",
i + sequence * pageMgr.pagesPerPIP);
#endif
}
@ -715,7 +715,7 @@ PAG PAG_allocate_pages(thread_db* tdbb, WIN* window, int cntAlloc, bool aligned)
#ifdef VIO_DEBUG
VIO_trace(DEBUG_WRITES_INFO,
"\tPAG_allocate: allocated page %" SLONGFORMAT"\n",
"PAG_allocate: allocated page %" SLONGFORMAT"\n",
bit + sequence * pageMgr.pagesPerPIP);
#endif
}
@ -1561,11 +1561,19 @@ void PAG_release_pages(thread_db* tdbb, USHORT pageSpaceID, int cntRelease,
page_inv_page* pages = NULL;
ULONG sequence = 0;
#ifdef VIO_DEBUG
string dbg = "PAG_release_pages: about to release pages: ";
#endif
for (int i = 0; i < cntRelease; i++)
{
#ifdef VIO_DEBUG
VIO_trace(DEBUG_WRITES_INFO,
"\tPAG_release_pages: about to release page %" SLONGFORMAT"\n", pgNums[i]);
if (i > 0)
dbg.append(", ");
char num[16];
_ltoa_s(pgNums[i], num, sizeof(num), 10);
dbg.append(num);
#endif
const ULONG seq = pgNums[i] / pageMgr.pagesPerPIP;
@ -1600,6 +1608,10 @@ void PAG_release_pages(thread_db* tdbb, USHORT pageSpaceID, int cntRelease,
pages->pip_min = MIN(pages->pip_min, relative_bit);
}
#ifdef VIO_DEBUG
VIO_trace(DEBUG_WRITES_INFO, "%s\n", dbg.c_str());
#endif
pageSpace->pipHighWater.exchangeLower(sequence);
if (pages->pip_extent < pageMgr.pagesPerPIP)

View File

@ -113,7 +113,7 @@ static void garbage_collect_idx(thread_db*, record_param*, Record*, Record*);
#include <stdio.h>
#include <stdarg.h>
int vio_debug_flag = 0;
int vio_debug_flag = DEBUG_TRACE_ALL_INFO;
void VIO_trace(int level, const char* format, ...)
{
@ -427,14 +427,14 @@ void VIO_backout(thread_db* tdbb, record_param* rpb, const jrd_tra* transaction)
fb_assert(assert_gc_enabled(transaction, rpb->rpb_relation));
jrd_rel* const relation = rpb->rpb_relation;
#ifdef VIO_DEBUG
VIO_trace(DEBUG_WRITES,
"VIO_backout (record_param %" QUADFORMAT"d, transaction %" SQUADFORMAT")\n",
rpb->rpb_number.getValue(), transaction ? transaction->tra_number : 0);
"VIO_backout (rel_id %u, record_param %" SQUADFORMAT", transaction %" SQUADFORMAT")\n",
relation->rel_id, rpb->rpb_number.getValue(), transaction ? transaction->tra_number : 0);
#endif
jrd_rel* const relation = rpb->rpb_relation;
// If there is data in the record, fetch it now. If the old version
// is a differences record, we will need it sooner. In any case, we
// will need it eventually to clean up blobs and indices. If the record
@ -740,8 +740,9 @@ bool VIO_chase_record_version(thread_db* tdbb, record_param* rpb,
#ifdef VIO_DEBUG
VIO_trace(DEBUG_TRACE_ALL,
"VIO_chase_record_version (record_param %" QUADFORMAT"d, transaction %"
"VIO_chase_record_version (rel_id %u, record_param %" QUADFORMAT"d, transaction %"
SQUADFORMAT", pool %p)\n",
relation->rel_id,
rpb->rpb_number.getValue(), transaction ? transaction->tra_number : 0,
(void*) pool);
@ -1324,10 +1325,12 @@ void VIO_data(thread_db* tdbb, record_param* rpb, MemoryPool* pool)
**************************************/
SET_TDBB(tdbb);
jrd_rel* const relation = rpb->rpb_relation;
#ifdef VIO_DEBUG
VIO_trace(DEBUG_READS,
"VIO_data (record_param %" QUADFORMAT"d, pool %p)\n",
rpb->rpb_number.getValue(), (void*) pool);
"VIO_data (rel_id %u, record_param %" QUADFORMAT"d, pool %p)\n",
relation->rel_id, rpb->rpb_number.getValue(), (void*)pool);
VIO_trace(DEBUG_READS_INFO,
@ -1343,7 +1346,6 @@ void VIO_data(thread_db* tdbb, record_param* rpb, MemoryPool* pool)
// the format block and set up the record block. This is a performance
// optimization.
jrd_rel* const relation = rpb->rpb_relation;
Record* const record = VIO_record(tdbb, rpb, NULL, pool);
const Format* const format = record->getFormat();
@ -1452,11 +1454,12 @@ void VIO_erase(thread_db* tdbb, record_param* rpb, jrd_tra* transaction)
SET_TDBB(tdbb);
jrd_req* request = tdbb->getRequest();
jrd_rel* relation = rpb->rpb_relation;
#ifdef VIO_DEBUG
VIO_trace(DEBUG_WRITES,
"VIO_erase (record_param %" QUADFORMAT"d, transaction %" SQUADFORMAT")\n",
rpb->rpb_number.getValue(), transaction->tra_number);
"VIO_erase (rel_id %u, record_param %" QUADFORMAT"d, transaction %" SQUADFORMAT")\n",
relation->rel_id, rpb->rpb_number.getValue(), transaction->tra_number);
VIO_trace(DEBUG_WRITES_INFO,
" record %" SLONGFORMAT":%d, rpb_trans %" SQUADFORMAT
@ -1491,7 +1494,6 @@ void VIO_erase(thread_db* tdbb, record_param* rpb, jrd_tra* transaction)
}
transaction->tra_flags |= TRA_write;
jrd_rel* relation = rpb->rpb_relation;
check_gbak_cheating_delete(tdbb, relation);
@ -1991,10 +1993,11 @@ bool VIO_garbage_collect(thread_db* tdbb, record_param* rpb, const jrd_tra* tran
Jrd::Attachment* attachment = transaction->tra_attachment;
#ifdef VIO_DEBUG
jrd_rel* relation = rpb->rpb_relation;
VIO_trace(DEBUG_TRACE,
"VIO_garbage_collect (record_param %" QUADFORMAT"d, transaction %"
"VIO_garbage_collect (rel_id %u, record_param %" QUADFORMAT"d, transaction %"
SQUADFORMAT")\n",
rpb->rpb_number.getValue(), transaction ? transaction->tra_number : 0);
relation->rel_id, rpb->rpb_number.getValue(), transaction ? transaction->tra_number : 0);
VIO_trace(DEBUG_TRACE_INFO,
" record %" SLONGFORMAT":%d, rpb_trans %" SQUADFORMAT
@ -2126,9 +2129,10 @@ bool VIO_get(thread_db* tdbb, record_param* rpb, jrd_tra* transaction, MemoryPoo
SET_TDBB(tdbb);
#ifdef VIO_DEBUG
jrd_rel* relation = rpb->rpb_relation;
VIO_trace(DEBUG_READS,
"VIO_get (record_param %" QUADFORMAT"d, transaction %" SQUADFORMAT", pool %p)\n",
rpb->rpb_number.getValue(), transaction ? transaction->tra_number : 0,
"VIO_get (rel_id %u, record_param %" QUADFORMAT"d, transaction %" SQUADFORMAT", pool %p)\n",
relation->rel_id, rpb->rpb_number.getValue(), transaction ? transaction->tra_number : 0,
(void*) pool);
#endif
@ -2205,9 +2209,10 @@ bool VIO_get_current(thread_db* tdbb,
Attachment* const attachment = tdbb->getAttachment();
#ifdef VIO_DEBUG
jrd_rel* relation = rpb->rpb_relation;
VIO_trace(DEBUG_TRACE,
"VIO_get_current (record_param %" QUADFORMAT"d, transaction %" SQUADFORMAT", pool %p)\n",
rpb->rpb_number.getValue(), transaction ? transaction->tra_number : 0,
"VIO_get_current (rel_id %u, record_param %" QUADFORMAT"d, transaction %" SQUADFORMAT", pool %p)\n",
relation->rel_id, rpb->rpb_number.getValue(), transaction ? transaction->tra_number : 0,
(void*) pool);
#endif
@ -2525,12 +2530,13 @@ void VIO_modify(thread_db* tdbb, record_param* org_rpb, record_param* new_rpb, j
SET_TDBB(tdbb);
MetaName object_name, package_name;
jrd_rel* relation = org_rpb->rpb_relation;
#ifdef VIO_DEBUG
VIO_trace(DEBUG_WRITES,
"VIO_modify (org_rpb %" QUADFORMAT"d, new_rpb %" QUADFORMAT"d, "
"VIO_modify (rel_id %u, org_rpb %" QUADFORMAT"d, new_rpb %" QUADFORMAT"d, "
"transaction %" SQUADFORMAT")\n",
org_rpb->rpb_number.getValue(), new_rpb->rpb_number.getValue(),
relation->rel_id, org_rpb->rpb_number.getValue(), new_rpb->rpb_number.getValue(),
transaction ? transaction->tra_number : 0);
VIO_trace(DEBUG_WRITES_INFO,
@ -2541,7 +2547,6 @@ void VIO_modify(thread_db* tdbb, record_param* org_rpb, record_param* new_rpb, j
org_rpb->rpb_f_page, org_rpb->rpb_f_line);
#endif
jrd_rel* relation = org_rpb->rpb_relation;
transaction->tra_flags |= TRA_write;
new_rpb->rpb_transaction_nr = transaction->tra_number;
new_rpb->rpb_flags = 0;
@ -3009,9 +3014,10 @@ bool VIO_next_record(thread_db* tdbb,
const USHORT lock_type = (rpb->rpb_stream_flags & RPB_s_update) ? LCK_write : LCK_read;
#ifdef VIO_DEBUG
jrd_rel* relation = rpb->rpb_relation;
VIO_trace(DEBUG_TRACE,
"VIO_next_record (record_param %" QUADFORMAT"d, transaction %" SQUADFORMAT", pool %p)\n",
rpb->rpb_number.getValue(), transaction ? transaction->tra_number : 0,
"VIO_next_record (rel_id %u, record_param %" QUADFORMAT"d, transaction %" SQUADFORMAT", pool %p)\n",
relation->rel_id, rpb->rpb_number.getValue(), transaction ? transaction->tra_number : 0,
(void*) pool);
VIO_trace(DEBUG_TRACE_INFO,
@ -3076,9 +3082,10 @@ Record* VIO_record(thread_db* tdbb, record_param* rpb, const Format* format, Mem
SET_TDBB(tdbb);
#ifdef VIO_DEBUG
jrd_rel* relation = rpb->rpb_relation;
VIO_trace(DEBUG_TRACE,
"VIO_record (record_param %" QUADFORMAT"d, format %d, pool %p)\n",
rpb->rpb_number.getValue(), format ? format->fmt_version : 0,
"VIO_record (rel_id %u, record_param %" QUADFORMAT"d, format %d, pool %p)\n",
relation->rel_id, rpb->rpb_number.getValue(), format ? format->fmt_version : 0,
(void*) pool);
#endif
@ -3118,9 +3125,10 @@ bool VIO_refetch_record(thread_db* tdbb, record_param* rpb, jrd_tra* transaction
*
**************************************/
#ifdef VIO_DEBUG
jrd_rel* relation = rpb->rpb_relation;
VIO_trace(DEBUG_READS,
"VIO_refetch_record (record_param %" QUADFORMAT"d, transaction %" SQUADFORMAT")\n",
rpb->rpb_number.getValue(), transaction ? transaction->tra_number : 0);
"VIO_refetch_record (rel_id %u, record_param %" QUADFORMAT"d, transaction %" SQUADFORMAT")\n",
relation->rel_id, rpb->rpb_number.getValue(), transaction ? transaction->tra_number : 0);
#endif
const TraNumber tid_fetch = rpb->rpb_transaction_nr;
@ -3212,6 +3220,7 @@ void VIO_store(thread_db* tdbb, record_param* rpb, jrd_tra* transaction)
**************************************/
SET_TDBB(tdbb);
jrd_req* const request = tdbb->getRequest();
jrd_rel* relation = rpb->rpb_relation;
DeferredWork* work = NULL;
MetaName package_name;
@ -3220,13 +3229,12 @@ void VIO_store(thread_db* tdbb, record_param* rpb, jrd_tra* transaction)
#ifdef VIO_DEBUG
VIO_trace(DEBUG_WRITES,
"VIO_store (record_param %" QUADFORMAT"d, transaction %" SQUADFORMAT
")\n", rpb->rpb_number.getValue(),
"VIO_store (rel_id %u, record_param %" QUADFORMAT"d, transaction %" SQUADFORMAT
")\n", relation->rel_id, rpb->rpb_number.getValue(),
transaction ? transaction->tra_number : 0);
#endif
transaction->tra_flags |= TRA_write;
jrd_rel* relation = rpb->rpb_relation;
DSC desc, desc2;
check_gbak_cheating_insupd(tdbb, relation, "INSERT");
@ -3777,11 +3785,6 @@ void VIO_verb_cleanup(thread_db* tdbb, jrd_tra* transaction)
**************************************/
SET_TDBB(tdbb);
#ifdef VIO_DEBUG
VIO_trace(DEBUG_TRACE,
"VIO_verb_cleanup (transaction %" SQUADFORMAT")\n",
transaction ? transaction->tra_number : 0);
#endif
if (transaction->tra_flags & TRA_system)
return;
@ -3845,6 +3848,12 @@ void VIO_verb_cleanup(thread_db* tdbb, jrd_tra* transaction)
sav_point->sav_verb_actions = action->vct_next;
jrd_rel* relation = action->vct_relation;
#ifdef VIO_DEBUG
VIO_trace(DEBUG_TRACE,
"VIO_verb_cleanup (transaction %" SQUADFORMAT", savepoint %" SQUADFORMAT", verb_count %u)\n",
transaction->tra_number, sav_point->sav_number, sav_point->sav_verb_count);
#endif
if (sav_point->sav_verb_count || transaction->tra_save_point)
{
rpb.rpb_relation = relation;
@ -4046,10 +4055,11 @@ bool VIO_writelock(thread_db* tdbb, record_param* org_rpb, jrd_tra* transaction)
**************************************/
SET_TDBB(tdbb);
jrd_rel* const relation = org_rpb->rpb_relation;
#ifdef VIO_DEBUG
VIO_trace(DEBUG_WRITES,
"VIO_writelock (org_rpb %" QUADFORMAT"d, transaction %" SQUADFORMAT")\n",
org_rpb->rpb_number.getValue(), transaction ? transaction->tra_number : 0);
"VIO_writelock (rel_id %u, org_rpb %" QUADFORMAT"d, transaction %" SQUADFORMAT")\n",
relation->rel_id, org_rpb->rpb_number.getValue(), transaction ? transaction->tra_number : 0);
VIO_trace(DEBUG_WRITES_INFO,
" old record %" SLONGFORMAT":%d, rpb_trans %" SQUADFORMAT
@ -4091,8 +4101,6 @@ bool VIO_writelock(thread_db* tdbb, record_param* org_rpb, jrd_tra* transaction)
org_rpb->rpb_format_number = org_format->fmt_version;
}
jrd_rel* const relation = org_rpb->rpb_relation;
// Set up the descriptor for the new record version. Initially,
// it points to the same record data as the original one.
record_param new_rpb = *org_rpb;
@ -4412,9 +4420,10 @@ static void delete_record(thread_db* tdbb, record_param* rpb, ULONG prior_page,
SET_TDBB(tdbb);
#ifdef VIO_DEBUG
jrd_rel* relation = rpb->rpb_relation;
VIO_trace(DEBUG_WRITES,
"delete_record (record_param %" QUADFORMAT"d, prior_page %" SLONGFORMAT", pool %p)\n",
rpb->rpb_number.getValue(), prior_page, (void*) pool);
"delete_record (rel_id %u, record_param %" QUADFORMAT"d, prior_page %" SLONGFORMAT", pool %p)\n",
relation->rel_id, rpb->rpb_number.getValue(), prior_page, (void*)pool);
VIO_trace(DEBUG_WRITES_INFO,
" delete_record record %" SLONGFORMAT":%d, rpb_trans %" SQUADFORMAT
@ -4489,9 +4498,10 @@ static UCHAR* delete_tail(thread_db* tdbb,
SET_TDBB(tdbb);
#ifdef VIO_DEBUG
jrd_rel* relation = rpb->rpb_relation;
VIO_trace(DEBUG_WRITES,
"delete_tail (record_param %" QUADFORMAT"d, prior_page %" SLONGFORMAT", tail %p, tail_end %p)\n",
rpb->rpb_number.getValue(), prior_page, tail, tail_end);
"delete_tail (rel_id %u, record_param %" QUADFORMAT"d, prior_page %" SLONGFORMAT", tail %p, tail_end %p)\n",
relation->rel_id, rpb->rpb_number.getValue(), prior_page, tail, tail_end);
VIO_trace(DEBUG_WRITES_INFO,
" tail of record %" SLONGFORMAT":%d, rpb_trans %" SQUADFORMAT
@ -4577,10 +4587,11 @@ static void expunge(thread_db* tdbb, record_param* rpb, const jrd_tra* transacti
fb_assert(assert_gc_enabled(transaction, rpb->rpb_relation));
#ifdef VIO_DEBUG
jrd_rel* relation = rpb->rpb_relation;
VIO_trace(DEBUG_WRITES,
"expunge (record_param %" QUADFORMAT"d, transaction %" SQUADFORMAT
"expunge (rel_id %u, record_param %" QUADFORMAT"d, transaction %" SQUADFORMAT
", prior_page %" SLONGFORMAT")\n",
rpb->rpb_number.getValue(), transaction ? transaction->tra_number : 0,
relation->rel_id, rpb->rpb_number.getValue(), transaction ? transaction->tra_number : 0,
prior_page);
#endif
@ -4662,9 +4673,10 @@ static void garbage_collect(thread_db* tdbb, record_param* rpb, ULONG prior_page
SET_TDBB(tdbb);
#ifdef VIO_DEBUG
jrd_rel* relation = rpb->rpb_relation;
VIO_trace(DEBUG_WRITES,
"garbage_collect (record_param %" QUADFORMAT"d, prior_page %" SLONGFORMAT", staying)\n",
rpb->rpb_number.getValue(), prior_page);
"garbage_collect (rel_id %u, record_param %" QUADFORMAT"d, prior_page %" SLONGFORMAT", staying)\n",
relation->rel_id, rpb->rpb_number.getValue(), prior_page);
VIO_trace(DEBUG_WRITES_INFO,
" record %" SLONGFORMAT":%d, rpb_trans %" SQUADFORMAT
@ -5520,12 +5532,13 @@ static int prepare_update( thread_db* tdbb,
SET_TDBB(tdbb);
Attachment* const attachment = tdbb->getAttachment();
jrd_rel* const relation = rpb->rpb_relation;
#ifdef VIO_DEBUG
VIO_trace(DEBUG_TRACE_ALL,
"prepare_update (transaction %" SQUADFORMAT
"prepare_update (rel_id %u, transaction %" SQUADFORMAT
", commit_tid read %" SQUADFORMAT", record_param %" QUADFORMAT"d, ",
transaction ? transaction->tra_number : 0, commit_tid_read,
relation->rel_id, transaction ? transaction->tra_number : 0, commit_tid_read,
rpb ? rpb->rpb_number.getValue() : 0);
VIO_trace(DEBUG_TRACE_ALL,
@ -5559,8 +5572,6 @@ static int prepare_update( thread_db* tdbb,
the record and committed, then an update error will be returned.
*/
jrd_rel* const relation = rpb->rpb_relation;
*temp = *rpb;
Record* const record = rpb->rpb_record;
@ -5939,9 +5950,11 @@ static void purge(thread_db* tdbb, record_param* rpb)
fb_assert(assert_gc_enabled(tdbb->getTransaction(), rpb->rpb_relation));
jrd_rel* const relation = rpb->rpb_relation;
#ifdef VIO_DEBUG
VIO_trace(DEBUG_TRACE_ALL,
"purge (record_param %" QUADFORMAT"d)\n", rpb->rpb_number.getValue());
"purge (rel_id %u, record_param %" QUADFORMAT"d)\n",
relation->rel_id, rpb->rpb_number.getValue());
VIO_trace(DEBUG_TRACE_ALL_INFO,
" record %" SLONGFORMAT":%d, rpb_trans %" SQUADFORMAT
@ -5956,7 +5969,6 @@ static void purge(thread_db* tdbb, record_param* rpb)
// the record.
record_param temp = *rpb;
jrd_rel* const relation = rpb->rpb_relation;
AutoGCRecord gc_rec(VIO_gc_record(tdbb, relation));
Record* record = rpb->rpb_record = gc_rec;
@ -6018,9 +6030,10 @@ static void replace_record(thread_db* tdbb,
SET_TDBB(tdbb);
#ifdef VIO_DEBUG
jrd_rel* relation = rpb->rpb_relation;
VIO_trace(DEBUG_TRACE_ALL,
"replace_record (record_param %" QUADFORMAT"d, transaction %" SQUADFORMAT")\n",
rpb->rpb_number.getValue(), transaction ? transaction->tra_number : 0);
"replace_record (rel_id %u, record_param %" QUADFORMAT"d, transaction %" SQUADFORMAT")\n",
relation->rel_id, rpb->rpb_number.getValue(), transaction ? transaction->tra_number : 0);
VIO_trace(DEBUG_TRACE_ALL_INFO,
" record %" SLONGFORMAT":%d, rpb_trans %" SQUADFORMAT
@ -6251,11 +6264,12 @@ static void update_in_place(thread_db* tdbb,
Database* dbb = tdbb->getDatabase();
CHECK_DBB(dbb);
jrd_rel* const relation = org_rpb->rpb_relation;
#ifdef VIO_DEBUG
VIO_trace(DEBUG_TRACE_ALL,
"update_in_place (transaction %" SQUADFORMAT", org_rpb %" QUADFORMAT"d, "
"update_in_place (rel_id %u, transaction %" SQUADFORMAT", org_rpb %" QUADFORMAT"d, "
"new_rpb %" QUADFORMAT"d)\n",
transaction ? transaction->tra_number : 0, org_rpb->rpb_number.getValue(),
relation->rel_id, transaction ? transaction->tra_number : 0, org_rpb->rpb_number.getValue(),
new_rpb ? new_rpb->rpb_number.getValue() : 0);
VIO_trace(DEBUG_TRACE_ALL_INFO,
@ -6267,7 +6281,6 @@ static void update_in_place(thread_db* tdbb,
#endif
PageStack& stack = new_rpb->rpb_record->getPrecedence();
jrd_rel* const relation = org_rpb->rpb_relation;
Record* const old_data = org_rpb->rpb_record;
// If the old version has been stored as a delta, things get complicated. Clearly,