Skip to content

Commit 47327a1

Browse files
committed
Fixed #8237: Database access error when nbackup is starting
(cherry picked from commit 1e6bd16)
1 parent 3e62713 commit 47327a1

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

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

259276
setHeader(h);
260277
}

0 commit comments

Comments
 (0)