MCPcopy Create free account
hub / github.com/FirebirdSQL/firebird / extendDatabase

Method extendDatabase

src/jrd/nbak.cpp:383–428  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

381
382
383bool BackupManager::extendDatabase(thread_db* tdbb)
384{
385 if (!alloc_table)
386 {
387 LocalAllocWriteGuard localAllocGuard(this);
388 actualizeAlloc(tdbb, false);
389 }
390
391 ULONG maxPage = 0;
392 {
393 LocalAllocReadGuard localAllocGuard(this);
394 AllocItemTree::Accessor all(alloc_table);
395
396 if (all.getFirst())
397 {
398 do
399 {
400 const ULONG pg = all.current().db_page;
401 if (maxPage < pg)
402 maxPage = pg;
403 } while (all.getNext());
404 }
405 }
406
407 PageSpace *pgSpace = database->dbb_page_manager.findPageSpace(DB_PAGE_SPACE);
408 ULONG maxAllocPage = pgSpace->maxAlloc();
409 if (maxAllocPage >= maxPage)
410 return true;
411
412 if (!pgSpace->extend(tdbb, maxPage, true))
413 return false;
414
415 maxAllocPage = pgSpace->maxAlloc();
416 while (maxAllocPage < maxPage)
417 {
418 const USHORT ret = PIO_init_data(tdbb, pgSpace->file, tdbb->tdbb_status_vector,
419 maxAllocPage, 256);
420
421 if (ret != 256)
422 return false;
423
424 maxAllocPage += ret;
425 }
426
427 return true;
428}
429
430
431// Merge difference file to main files (if needed) and unlink() difference

Callers

nothing calls this directly

Calls 7

findPageSpaceMethod · 0.80
maxAllocMethod · 0.80
PIO_init_dataFunction · 0.50
getFirstMethod · 0.45
currentMethod · 0.45
getNextMethod · 0.45
extendMethod · 0.45

Tested by

no test coverage detected