| 381 | |
| 382 | |
| 383 | bool 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 |
nothing calls this directly
no test coverage detected