Skip to content

Commit 23711dc

Browse files
committed
Fixed #8237: Database access error when nbackup is starting
(cherry picked from commit 1e6bd16)
1 parent c84d945 commit 23711dc

File tree

1 file changed

+22
-5
lines changed

1 file changed

+22
-5
lines changed

src/jrd/CryptoManager.cpp

Lines changed: 22 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -225,7 +225,29 @@ namespace Jrd {
225225
if (bak_state != Ods::hdr_nbak_normal)
226226
diff_page = bm->getPageIndex(tdbb, bdb.bdb_page.getPageNum());
227227

228+
bool readPageAsNormal = false;
228229
if (bak_state == Ods::hdr_nbak_normal || !diff_page)
230+
readPageAsNormal = true;
231+
else
232+
{
233+
if (!bm->readDifference(tdbb, diff_page, page))
234+
{
235+
if (page->pag_type == 0 && page->pag_generation == 0 && page->pag_scn == 0)
236+
{
237+
// We encountered a page which was allocated, but never written to the
238+
// difference file. In this case we try to read the page from database. With
239+
// this approach if the page was old we get it from DISK, and if the page
240+
// was new IO error (EOF) or BUGCHECK (checksum error) will be the result.
241+
// Engine is not supposed to read a page which was never written unless
242+
// this is a merge process.
243+
readPageAsNormal = true;
244+
}
245+
else
246+
ERR_punt();
247+
}
248+
}
249+
250+
if (readPageAsNormal)
229251
{
230252
// Read page from disk as normal
231253
int retryCount = 0;
@@ -247,11 +269,6 @@ namespace Jrd {
247269
}
248270
}
249271
}
250-
else
251-
{
252-
if (!bm->readDifference(tdbb, diff_page, page))
253-
ERR_punt();
254-
}
255272

256273
setHeader(h);
257274
}

0 commit comments

Comments
 (0)