Why FoudationDB can't restore data to a non-empty database

I’m trying to import data from one FDB to another existing non-empty FDB using fdbbackup and fdbrestore.

But when i ran command fdbrestore to non-empty FDB server, this raise an error:

ERROR: Attempted to restore into a non-empty destination database
Fatal Error: Attempted to restore into a non-empty destination database

I want to know why FDB can’t restore to existing non-empty FDB. I think it useful to support restore DB like that.


Restore only requires that the destination key range be empty, though normally this is the entire keyspace for a full backup + full restore. This requirement is because doing otherwise would not have a well defined result. Restore does not clear the destination range automatically for safety reasons.

Backups are a series of many disjoint key range snapshots, taken over time at different versions, of key-value pairs and the mutations that modify them. Restore writes these key-value pairs and re-executes the mutations that modified them between the time of their snapshot and the point in time of the restore. Applying these mutations to existing data in the restore cluster would yield different results based on the mutations that were part of the backup, which itself would vary per key range based on when in the backup process that key range’s snapshot was stored.

For example, if database X contains
A = 10 (byte string 0x0a)
and database Y contains
A = 1 (byte string 0x01)
then restoring a backup of database Y into database X without clearing key A could yield an after-restore value for key A of 1, 10, 11, 2561 (byte string 0x0a01), or something else. It would depend on when A was snapshotted in the backup of database Y, and then what mutations (sets, clears, atomic ops such as increment/decrement, append, min/max) resulted in A=1 after that point.

Thanks so much for your reply!