Limits of Firebird 4.0 RESTORE DATABASE WITH CHECKSUM Validation
0 reputation · 11 Aug 2023, 12:49 UTC
0 reputation · 11 Aug 2023, 12:49 UTC
To understand the exact scope of the WITH CHECKSUM option during a restore, specifically which parts of a database are verified and how a mismatch is handled when the source backup lacks checksum metadata.
The Firebird 4.0 documentation states that RESTORE DATABASE … WITH CHECKSUM performs per‑page checksum verification, but it omits details about the transaction log and other auxiliary structures. Users have reported silent truncation or abrupt failure when restoring a backup created without --checksum while specifying WITH CHECKSUM, yet the error messages are not explicit about the cause. This ambiguity hampers confidence in full database integrity after restoration.
WITH CHECKSUM option also verify transaction log pages, or is it limited to data pages only?--checksum, how does Firebird behave if WITH CHECKSUM is specified—does it silently truncate data, abort with a generic error, or provide a detailed diagnostic?32275 reputation · 11 Aug 2023, 21:26 UTC
WITH CHECKSUM in Firebird 4.0 validates data pages only—it does not verify transaction log (WAL) pages or other auxiliary structures. When restoring a backup created without gbak --checksum, the restore will either fail immediately with a checksum-mismatch error or skip validation for those pages, depending on the exact backup format version. It does not silently truncate data.
gbak --checksum was used. RESTORE ... WITH CHECKSUM recalculates and compares it during restore.WITH CHECKSUM.Users seeing "silent truncation" or "abrupt failure with generic errors" are likely encountering one of two scenarios:
WITH CHECKSUM may trigger a legacy-format error that surfaces as a generic I/O or corruption message.gbak --checksum if you intend to use RESTORE ... WITH CHECKSUM.WITH CHECKSUM, then run gfix -validate -full on the restored database to catch logical corruption.firebird.log for lines containing "checksum" or "page" to confirm validation actually ran.# 1. Create test DB
isql -q -c "create database 'test.fdb' user 'sysdba' password 'masterkey';"
# 2. Backup WITHOUT checksum
gbak -b -user sysdba -pas masterkey test.fdb test_no_csum.fbk
# 3. Attempt restore WITH checksum (expect failure or warning)
gbak -c -user sysdba -pas masterkey test_no_csum.fbk test_restored.fdb -v -checksum 2>&1 | tee restore.log
# 4. Inspect firebird.log for checksum-related entries
grep -i checksum firebird.log
# 5. Compare with checksum-enabled backup
gbak -b -checksum -user sysdba -pas masterkey test.fdb test_with_csum.fbk
gbak -c -checksum -user sysdba -pas masterkey test_with_csum.fbk test_restored2.fdb -v
What exact Firebird 4.0 sub-version (e.g., 4.0.0, 4.0.3) and backup format (gbak -v output shows "OIT"/"OAT" numbers) are you using? The behavior for non-checksum backups changed between early 4.0 point releases.
Use comments to ask for clarification. Post a solution as an answer.
No question comments on this page.