mirror of
https://github.com/FirebirdSQL/firebird.git
synced 2025-01-23 18:43:03 +01:00
Misc
This commit is contained in:
parent
a8a37263a1
commit
2d62037b2a
@ -857,12 +857,12 @@ static FETCH_CODE fetch_page(thread_db* tdbb,
|
||||
// sometimes will fetch the same page more than once. In that
|
||||
// event we don't report double allocation. If the page is truely
|
||||
// double allocated (to more than one relation) we'll find it
|
||||
// when the on-page relation id doesn't match
|
||||
// when the on-page relation id doesn't match.
|
||||
// We also don't test SCN's pages here. If it double allocated this
|
||||
// will be detected when wrong page reference will be fetched with
|
||||
// non pag_scns type.
|
||||
|
||||
if ((type != pag_data) && (type != pag_scns) &&
|
||||
if (type != pag_data && type != pag_scns &&
|
||||
PageBitmap::test(control->vdr_page_bitmap, page_number))
|
||||
{
|
||||
corrupt(tdbb, control, VAL_PAG_DOUBLE_ALLOC, 0, page_number);
|
||||
@ -872,14 +872,14 @@ static FETCH_CODE fetch_page(thread_db* tdbb,
|
||||
// Check SCN's page
|
||||
if (page_number)
|
||||
{
|
||||
PageManager &pageMgr = dbb->dbb_page_manager;
|
||||
PageManager& pageMgr = dbb->dbb_page_manager;
|
||||
const ULONG scn_seq = page_number / pageMgr.pagesPerSCN;
|
||||
const ULONG scn_slot = page_number % pageMgr.pagesPerSCN;
|
||||
const ULONG scn_page_num = PageSpace::getSCNPageNum(dbb, scn_seq);
|
||||
const ULONG page_scn = (*page_pointer)->pag_scn;
|
||||
|
||||
WIN scns_window(DB_PAGE_SPACE, scn_page_num);
|
||||
scns_page *scns = (scns_page*) *page_pointer;
|
||||
scns_page* scns = (scns_page*) *page_pointer;
|
||||
|
||||
if (scn_page_num != page_number) {
|
||||
fetch_page(tdbb, control, scn_page_num, pag_scns, &scns_window, &scns);
|
||||
@ -891,7 +891,7 @@ static FETCH_CODE fetch_page(thread_db* tdbb,
|
||||
|
||||
if (control->vdr_flags & vdr_update)
|
||||
{
|
||||
WIN *win = (scn_page_num == page_number) ? window : &scns_window;
|
||||
WIN* win = (scn_page_num == page_number) ? window : &scns_window;
|
||||
CCH_MARK(tdbb, win);
|
||||
|
||||
scns->scn_pages[scn_slot] = page_scn;
|
||||
@ -1533,7 +1533,7 @@ static RTN walk_index(thread_db* tdbb, vdr* control, jrd_rel* relation,
|
||||
else
|
||||
{
|
||||
// Check if jump node has same length as data node prefix.
|
||||
BTreeNode::readNode(&checknode, (UCHAR*)page + jumpNode.offset, leafPage);
|
||||
BTreeNode::readNode(&checknode, (UCHAR*) page + jumpNode.offset, leafPage);
|
||||
if ((jumpNode.prefix + jumpNode.length) != checknode.prefix) {
|
||||
corrupt(tdbb, control, VAL_INDEX_PAGE_CORRUPT, relation,
|
||||
id + 1, next, page->btr_level, __FILE__, __LINE__);
|
||||
@ -1589,7 +1589,7 @@ static RTN walk_index(thread_db* tdbb, vdr* control, jrd_rel* relation,
|
||||
nullKeyNode = false;
|
||||
}
|
||||
|
||||
if ((node.recordNumber.getValue() >= 0) && !firstNode && !node.isEndLevel)
|
||||
if (node.recordNumber.getValue() >= 0 && !firstNode && !node.isEndLevel)
|
||||
{
|
||||
// If this node is equal to the previous one and it's
|
||||
// not a MARKER, record number should be same or higher.
|
||||
@ -2248,8 +2248,8 @@ static RTN walk_scns(thread_db* tdbb, vdr* control)
|
||||
Database* dbb = tdbb->getDatabase();
|
||||
CHECK_DBB(dbb);
|
||||
|
||||
PageManager &pageMgr = dbb->dbb_page_manager;
|
||||
PageSpace *pageSpace = pageMgr.findPageSpace(DB_PAGE_SPACE);
|
||||
PageManager& pageMgr = dbb->dbb_page_manager;
|
||||
PageSpace* pageSpace = pageMgr.findPageSpace(DB_PAGE_SPACE);
|
||||
|
||||
const ULONG lastPage = pageSpace->lastUsedPage();
|
||||
const ULONG cntSCNs = lastPage / pageMgr.pagesPerSCN + 1;
|
||||
@ -2260,7 +2260,7 @@ static RTN walk_scns(thread_db* tdbb, vdr* control)
|
||||
{
|
||||
const ULONG scnPage = pageSpace->getSCNPageNum(sequence);
|
||||
WIN scnWindow(pageSpace->pageSpaceID, scnPage);
|
||||
scns_page *scns = NULL;
|
||||
scns_page* scns = NULL;
|
||||
fetch_page(tdbb, control, scnPage, pag_scns, &scnWindow, &scns);
|
||||
|
||||
if (scns->scn_sequence != sequence)
|
||||
|
@ -1061,4 +1061,3 @@ COMMIT WORK;
|
||||
stop
|
||||
|
||||
COMMIT WORK;
|
||||
|
||||
|
@ -849,6 +849,7 @@ void usage(bool listSwitches)
|
||||
{
|
||||
printf("%s\n", getMessage(i).c_str());
|
||||
}
|
||||
|
||||
if (! listSwitches)
|
||||
{
|
||||
printf("%s\n", getMessage(53).c_str());
|
||||
|
@ -344,7 +344,7 @@ size_t NBackup::read_file(FILE_HANDLE &file, void *buffer, size_t bufsize)
|
||||
|
||||
status_exception::raise(Arg::Gds(isc_nbackup_err_read) <<
|
||||
(&file == &dbase ? dbname.c_str() :
|
||||
&file == &backup ? bakname.c_str() : "unknown") <<
|
||||
&file == &backup ? bakname.c_str() : "unknown") <<
|
||||
Arg::OsError());
|
||||
|
||||
return 0; // silence compiler
|
||||
@ -363,7 +363,7 @@ void NBackup::write_file(FILE_HANDLE &file, void *buffer, size_t bufsize)
|
||||
|
||||
status_exception::raise(Arg::Gds(isc_nbackup_err_write) <<
|
||||
(&file == &dbase ? dbname.c_str() :
|
||||
&file == &backup ? bakname.c_str() : "unknown") <<
|
||||
&file == &backup ? bakname.c_str() : "unknown") <<
|
||||
Arg::OsError());
|
||||
}
|
||||
|
||||
@ -385,7 +385,7 @@ void NBackup::seek_file(FILE_HANDLE &file, SINT64 pos)
|
||||
|
||||
status_exception::raise(Arg::Gds(isc_nbackup_err_seek) <<
|
||||
(&file == &dbase ? dbname.c_str() :
|
||||
&file == &backup ? bakname.c_str() : "unknown") <<
|
||||
&file == &backup ? bakname.c_str() : "unknown") <<
|
||||
Arg::OsError());
|
||||
}
|
||||
|
||||
@ -738,7 +738,6 @@ void NBackup::unlock_database()
|
||||
|
||||
void NBackup::backup_database(int level, const PathName& fname)
|
||||
{
|
||||
|
||||
bool database_locked = false;
|
||||
// We set this flag when backup file is in inconsistent state
|
||||
bool delete_backup = false;
|
||||
@ -749,7 +748,7 @@ void NBackup::backup_database(int level, const PathName& fname)
|
||||
ULONG page_writes = 0, page_reads = 0;
|
||||
|
||||
time_t start = time(NULL);
|
||||
const struct tm *today = localtime(&start);
|
||||
const struct tm* today = localtime(&start);
|
||||
|
||||
try {
|
||||
// Look for SCN and GUID of previous-level backup in history table
|
||||
@ -841,8 +840,8 @@ void NBackup::backup_database(int level, const PathName& fname)
|
||||
// Read database header
|
||||
char unaligned_header_buffer[SECTOR_ALIGNMENT * 2];
|
||||
|
||||
Ods::header_page *header =
|
||||
reinterpret_cast<Ods::header_page*>(FB_ALIGN((IPTR) unaligned_header_buffer, SECTOR_ALIGNMENT));
|
||||
Ods::header_page *header = reinterpret_cast<Ods::header_page*>(
|
||||
FB_ALIGN((IPTR) unaligned_header_buffer, SECTOR_ALIGNMENT));
|
||||
|
||||
if (read_file(dbase, header, SECTOR_ALIGNMENT/*sizeof(*header)*/) != SECTOR_ALIGNMENT/*sizeof(*header)*/)
|
||||
status_exception::raise(Arg::Gds(isc_nbackup_err_eofhdrdb) << dbname.c_str() << Arg::Num(1));
|
||||
@ -921,7 +920,7 @@ void NBackup::backup_database(int level, const PathName& fname)
|
||||
const ULONG pagesPerSCN = Ods::pagesPerSCN(header->hdr_page_size);
|
||||
|
||||
Array<UCHAR> unaligned_scns_buffer;
|
||||
Ods::scns_page *scns = NULL, *scns_buf = NULL;
|
||||
Ods::scns_page* scns = NULL, *scns_buf = NULL;
|
||||
{ // scope
|
||||
UCHAR* buf = unaligned_scns_buffer.getBuffer(header->hdr_page_size + SECTOR_ALIGNMENT);
|
||||
scns_buf = reinterpret_cast<Ods::scns_page*>(FB_ALIGN((IPTR) buf, SECTOR_ALIGNMENT));
|
||||
@ -1587,7 +1586,7 @@ void nbackup(UtilSvc* uSvc)
|
||||
}
|
||||
catch (const Exception& e)
|
||||
{
|
||||
if ((!uSvc->isService()) && (!nbk.printed()))
|
||||
if (!uSvc->isService() && !nbk.printed())
|
||||
{
|
||||
ISC_STATUS_ARRAY status;
|
||||
e.stuff_exception(status);
|
||||
|
Loading…
Reference in New Issue
Block a user