lib/db: Recover sequence number and metadata on startup (fixes #6335) If we crashed after writing new file entries but before updating metadata in the database the sequence number and metadata will be wrong. This fixes that.