<!-- DO NOT DELETE validate_template=true template_path=.github/ISSUE_TEMPLATE/bug_report.md --> <!-- Thank you for contributing to the Firebase community! Think you found a bug? ======================= Yeah, we're definitely not perfect! Please use this template and include a minimal repro when opening the issue. If you know how to solve the issue, please create a Pull Request, and we'd be happy to review it! Have a feature request? ======================== Great, we love hearing how we can improve our products! However, do not use this template to submit a feature request. Please submit your feature requests to: https://firebase.google.com/support/contact/bugs-features/ Have a usage question? ======================= We get lots of those and we love helping you, but GitHub is not the best place for them and they will be closed. Please take a look at the guide first: https://firebase.google.com/docs/cli/ If the official documentation doesn't help, try asking through our official support channel: https://firebase.google.com/support/ Additional locations to check for solutions or assistance from the community: - Stack Overflow: https://stackoverflow.com/ - Firebase Slack Community: https://firebase.community/ *Please avoid duplicate posting across multiple channels!* --> ### [REQUIRED] Environment info <!-- What version of the Firebase CLI (`firebase-tools`) are you using? Note that your issue may already be fixed in the latest versions. The latest version can be found at https://github.com/firebase/firebase-tools/releases --> <!-- Output of `firebase --version` --> **firebase-tools:** all <!-- e.g. macOS, Windows, Ubuntu --> **Platform:** all ### [REQUIRED] Test case In the export code for Firestore we delete all the existing export data *before* the new data is written: https://github.com/firebase/firebase-tools/blob/0641bd2e87e0a9b6f75ead0d6e50fd468635acc7/src/emulator/controller.ts#L782 This can cause data loss if the export fails. It can also cause issues like https://github.com/firebase/firebase-tools/issues/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.
Activity