Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Failed export can cause data loss #3504

Closed
samtstern opened this issue Jun 17, 2021 · 0 comments · Fixed by #3511
Closed

Failed export can cause data loss #3504

samtstern opened this issue Jun 17, 2021 · 0 comments · Fixed by #3511

Comments

@samtstern
Copy link
Contributor

[REQUIRED] Environment info

firebase-tools: all

Platform: all

[REQUIRED] Test case

In the export code for Firestore we delete all the existing export data before the new data is written:

rimraf.sync(firestorePath);

This can cause data loss if the export fails. It can also cause issues like #3487 where a clean shutdown puts the emulator in a bad state.

Instead we should:

  1. Export into a tmp directory
  2. If the export succeeds, overwrite the existing directory and delete the tmp data

[REQUIRED] Steps to reproduce

Hard to reproduce, but see above.

[REQUIRED] Expected behavior

Never lose data unless there is better data.

[REQUIRED] Actual behavior

See above.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant