Skip to content

Commit a2dbf36

Browse files
committed
Fixed #8237: Database access error when nbackup is starting
(cherry picked from commit 1e6bd16)
1 parent 35344cf commit a2dbf36

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
@@ -226,7 +226,29 @@ namespace Jrd {
226226
if (bak_state != Ods::hdr_nbak_normal)
227227
diff_page = bm->getPageIndex(tdbb, bdb.bdb_page.getPageNum());
228228

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

257274
setHeader(h);
258275
}

0 commit comments

Comments
 (0)