Firebase Database CLI remove command do not work

Viewed 342

By accident, I had created an endless loop in my android studio app which has added over 100k+ records to my Realtime Database. After closing everything I wanted to delete this massive table using Firebase CLI but every time I try it i get an error:

 > firebase database:remove /matches
? You are about to remove all data at https://XXX.firebaseio.com/matches. Are you sure? Yes

Error: Task index 0 failed: retries exhausted after 4 attempts

How am I supposed to delete it then?

1 Answers

The most likely cause is that other clients are updating the data while your code is trying to remove it. If that is the case, the only way to work around it, is to remove the data in smaller chunks, to reduce the contention during the operation.

To do this, you'll:

  1. Read the data from /matches either through the API, or from an automatic backup.
  2. Determine a reasonable subset of the nodes to remove in one go.
  3. Make an API call to remove that subset of the data.
  4. Repeat this process until all data is gone.
Related