The file storage method checks the database data/plugins/file for recently modified (added or removed) files.
The normal sequence of events for adding a file to the database is:
If the transaction fails or is aborted, the file is not inserted into the database at all. Note that this DB transaction often involves many related changes to the database.
If the transaction fails or is aborted, the file is still not inserted into the database, but another insertion attempt will be made when recovery is run in the future.
The recovery procedure consists of repeating the second part of this sequence.
Note that in normal mode, the file's Hash has been `verified' (actually it was empirically determined recently) and in recovery mode, the cache recovery procedure verifies that all files in the cache have correct contents and removes (either deletes or moves into a holding area) those that don't. Thus it is not necessary to do an extra validation step in the second part of this sequence.