mirror of
https://github.com/FirebirdSQL/firebird.git
synced 2025-01-23 21:23:03 +01:00
Fixed bug CORE-3466 : Some changes could be lost during the merge of delta file into main database file.
Removed BDB_merge flag and related code.
This commit is contained in:
parent
5bbff34ac1
commit
d57814996f
@ -660,7 +660,7 @@ pag* CCH_fake(thread_db* tdbb, WIN* window, SSHORT latch_wait)
|
||||
|
||||
|
||||
pag* CCH_fetch(thread_db* tdbb, WIN* window, USHORT lock_type, SCHAR page_type, SSHORT latch_wait,
|
||||
const bool read_shadow, const bool merge_flag)
|
||||
const bool read_shadow)
|
||||
{
|
||||
/**************************************
|
||||
*
|
||||
@ -697,7 +697,7 @@ pag* CCH_fetch(thread_db* tdbb, WIN* window, USHORT lock_type, SCHAR page_type,
|
||||
{
|
||||
case 1:
|
||||
CCH_TRACE(("FE %d:%06d", window->win_page.getPageSpaceID(), window->win_page.getPageNum()));
|
||||
CCH_FETCH_PAGE(tdbb, window, read_shadow, merge_flag); // must read page from disk
|
||||
CCH_FETCH_PAGE(tdbb, window, read_shadow); // must read page from disk
|
||||
break;
|
||||
case -2:
|
||||
case -1:
|
||||
@ -706,11 +706,6 @@ pag* CCH_fetch(thread_db* tdbb, WIN* window, USHORT lock_type, SCHAR page_type,
|
||||
|
||||
BufferDesc* bdb = window->win_bdb;
|
||||
|
||||
// if merge_flag is not set the page will be changed before or after merge
|
||||
// and should be written into delta again
|
||||
if (!merge_flag)
|
||||
bdb->bdb_flags &= ~BDB_merge;
|
||||
|
||||
// If a page was read or prefetched on behalf of a large scan
|
||||
// then load the window scan count into the buffer descriptor.
|
||||
// This buffer scan count is decremented by releasing a buffer
|
||||
@ -829,7 +824,7 @@ SSHORT CCH_fetch_lock(thread_db* tdbb, WIN* window, USHORT lock_type, SSHORT wai
|
||||
return lock_result;
|
||||
}
|
||||
|
||||
void CCH_fetch_page(thread_db* tdbb, WIN* window, const bool read_shadow, const bool merge_flag)
|
||||
void CCH_fetch_page(thread_db* tdbb, WIN* window, const bool read_shadow)
|
||||
{
|
||||
/**************************************
|
||||
*
|
||||
@ -937,11 +932,7 @@ void CCH_fetch_page(thread_db* tdbb, WIN* window, const bool read_shadow, const
|
||||
CCH_unwind(tdbb, true);
|
||||
}
|
||||
|
||||
// This is the first reading the page from delta and it must not be written into it again
|
||||
if (merge_flag)
|
||||
bdb->bdb_flags |= BDB_merge;
|
||||
|
||||
if ((page->pag_type == 0) && !merge_flag)
|
||||
if (page->pag_type == 0)
|
||||
{
|
||||
// We encountered a page which was allocated, but never written to the
|
||||
// difference file. In this case we try to read the page from database. With
|
||||
@ -1458,7 +1449,7 @@ pag* CCH_handoff(thread_db* tdbb, WIN* window, ULONG page, SSHORT lock, SCHAR pa
|
||||
CCH_RELEASE(tdbb, &temp);
|
||||
|
||||
if (must_read) {
|
||||
CCH_FETCH_PAGE(tdbb, window, true, false);
|
||||
CCH_FETCH_PAGE(tdbb, window, true);
|
||||
}
|
||||
|
||||
BufferDesc* bdb = window->win_bdb;
|
||||
@ -5312,8 +5303,7 @@ static bool write_page(thread_db* tdbb, BufferDesc* bdb, ISC_STATUS* const statu
|
||||
const bool isTempPage = pageSpace->isTemporary();
|
||||
|
||||
if (!isTempPage && (backup_state == nbak_state_stalled ||
|
||||
(backup_state == nbak_state_merge &&
|
||||
bdb->bdb_difference_page && !(bdb->bdb_flags & BDB_merge))))
|
||||
(backup_state == nbak_state_merge && bdb->bdb_difference_page)))
|
||||
{
|
||||
|
||||
const bool res = dbb->dbb_backup_manager->writeDifference(status,
|
||||
@ -5397,7 +5387,7 @@ static bool write_page(thread_db* tdbb, BufferDesc* bdb, ISC_STATUS* const statu
|
||||
removeDirty(dbb->dbb_bcb, bdb);
|
||||
}
|
||||
|
||||
bdb->bdb_flags &= ~(BDB_must_write | BDB_system_dirty | BDB_merge);
|
||||
bdb->bdb_flags &= ~(BDB_must_write | BDB_system_dirty);
|
||||
clear_dirty_flag(tdbb, bdb);
|
||||
|
||||
if (bdb->bdb_flags & BDB_io_error)
|
||||
|
@ -155,10 +155,7 @@ const int BDB_writer = 4; // someone is updating the page
|
||||
const int BDB_marked = 8; // page has been updated
|
||||
const int BDB_must_write = 16; // forces a write as soon as the page is released
|
||||
const int BDB_faked = 32; // page was just allocated
|
||||
// BDB_merge: Page marked for backup merge purposes to prevent redundant writing
|
||||
// just read from delta page back into the delta while delta is merging.
|
||||
// See cch.cpp: write_page
|
||||
const int BDB_merge = 64;
|
||||
//const int BDB_merge = 64;
|
||||
const int BDB_system_dirty = 128; // system transaction has marked dirty
|
||||
const int BDB_io_error = 256; // page i/o error
|
||||
const int BDB_read_pending = 512; // read is pending
|
||||
|
@ -35,9 +35,9 @@ bool CCH_exclusive(Jrd::thread_db*, USHORT, SSHORT);
|
||||
bool CCH_exclusive_attachment(Jrd::thread_db*, USHORT, SSHORT);
|
||||
void CCH_expand(Jrd::thread_db*, ULONG);
|
||||
Ods::pag* CCH_fake(Jrd::thread_db*, Jrd::win*, SSHORT);
|
||||
Ods::pag* CCH_fetch(Jrd::thread_db*, Jrd::win*, USHORT, SCHAR, SSHORT, const bool, const bool);
|
||||
Ods::pag* CCH_fetch(Jrd::thread_db*, Jrd::win*, USHORT, SCHAR, SSHORT, const bool);
|
||||
SSHORT CCH_fetch_lock(Jrd::thread_db*, Jrd::win*, USHORT, SSHORT, SCHAR);
|
||||
void CCH_fetch_page(Jrd::thread_db*, Jrd::win*, const bool, const bool);
|
||||
void CCH_fetch_page(Jrd::thread_db*, Jrd::win*, const bool);
|
||||
void CCH_forget_page(Jrd::thread_db*, Jrd::win*);
|
||||
void CCH_fini(Jrd::thread_db*);
|
||||
void CCH_flush(Jrd::thread_db*, USHORT, SLONG);
|
||||
@ -68,22 +68,17 @@ bool CCH_write_all_shadows(Jrd::thread_db*, Jrd::Shadow*, Jrd::BufferDesc*,
|
||||
|
||||
inline Ods::pag* CCH_FETCH(Jrd::thread_db* tdbb, Jrd::win* window, USHORT lock_type, SCHAR page_type)
|
||||
{
|
||||
return CCH_fetch (tdbb, window, lock_type, page_type, 1, true, false);
|
||||
return CCH_fetch (tdbb, window, lock_type, page_type, 1, true);
|
||||
}
|
||||
|
||||
inline Ods::pag* CCH_FETCH_NO_SHADOW(Jrd::thread_db* tdbb, Jrd::win* window, USHORT lock_type, SCHAR page_type)
|
||||
{
|
||||
return CCH_fetch (tdbb, window, lock_type, page_type, 1, false, false);
|
||||
}
|
||||
|
||||
inline Ods::pag* CCH_FETCH_MERGE(Jrd::thread_db* tdbb, Jrd::win* window, USHORT lock_type, SCHAR page_type)
|
||||
{
|
||||
return CCH_fetch (tdbb, window, lock_type, page_type, 1, true, true);
|
||||
return CCH_fetch (tdbb, window, lock_type, page_type, 1, false);
|
||||
}
|
||||
|
||||
inline Ods::pag* CCH_FETCH_TIMEOUT(Jrd::thread_db* tdbb, Jrd::win* window, USHORT lock_type, SCHAR page_type, SSHORT latch_wait)
|
||||
{
|
||||
return CCH_fetch (tdbb, window, lock_type, page_type, latch_wait, true, false);
|
||||
return CCH_fetch (tdbb, window, lock_type, page_type, latch_wait, true);
|
||||
}
|
||||
|
||||
inline SSHORT CCH_FETCH_LOCK(Jrd::thread_db* tdbb, Jrd::win* window, USHORT lock_type, SSHORT wait, SCHAR page_type)
|
||||
@ -91,9 +86,9 @@ inline SSHORT CCH_FETCH_LOCK(Jrd::thread_db* tdbb, Jrd::win* window, USHORT lock
|
||||
return CCH_fetch_lock(tdbb, window, lock_type, wait, page_type);
|
||||
}
|
||||
|
||||
inline void CCH_FETCH_PAGE(Jrd::thread_db* tdbb, Jrd::win* window, bool read_shadow, bool merge_flag)
|
||||
inline void CCH_FETCH_PAGE(Jrd::thread_db* tdbb, Jrd::win* window, bool read_shadow)
|
||||
{
|
||||
CCH_fetch_page(tdbb, window, read_shadow, merge_flag);
|
||||
CCH_fetch_page(tdbb, window, read_shadow);
|
||||
}
|
||||
|
||||
inline void CCH_RELEASE(Jrd::thread_db* tdbb, Jrd::win* window)
|
||||
|
@ -435,7 +435,7 @@ void BackupManager::endBackup(thread_db* tdbb, bool recover)
|
||||
do {
|
||||
WIN window2(DB_PAGE_SPACE, all.current().db_page);
|
||||
NBAK_TRACE(("Merge page %d, diff=%d", all.current().db_page, all.current().diff_page));
|
||||
Ods::pag* page = CCH_FETCH_MERGE(tdbb, &window2, LCK_write, pag_undefined);
|
||||
Ods::pag* page = CCH_FETCH(tdbb, &window2, LCK_write, pag_undefined);
|
||||
NBAK_TRACE(("Merge: page %d is fetched", all.current().db_page));
|
||||
if (page->pag_scn != current_scn)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user