# Spec: failure protection for cf-meta create_db function
### stage 1:
for fmtc only, make sure that when the create_fmtc_db function failed, data from a previous database collection is used.
### stage 2:
for all feeds, make sure that when the create_db function failed, data from a previous database collection is used.
- note that affiliated_market feeds and direct feeds need to be treated differently, because CF/Elza cares a lot about individual stores
- for direct feeds, simply re-use the most recent database collection that has some non-expired products
- for affiliated market feeds, we need to do the above for each store seperately
- we define "failed" as: after the create_db function we do a check, if there are no active products for any store, we see the result as failed.
- optionally: add config support to always do this, instead of only doing it when failed, for boosting processing speed
### stage 3:
similar to stage 2, but instead of getting data from a previous database collection, get data from s3.
the data in s3 is updated every time we run updates.
**Note 1**, There should be a component that is dedicated for this feature, cf-meta will use that component to write to & read from. We can build a cli tool for this component so that other people can use it easily
**Note2**, another difference between stage 3 and stage 2: we want to save/load final normalized data, instead of the half normalized data we got from create_db functions
- final normalized data as in data in `MongoCollection:cf-prod.documents`
- half normalized data as in data in `MongoCollection:roots.roots_20200508`