DropAll would drop all the data stored in Badger. It does this in the following way. - Stop accepting new writes. - Pause memtable flushes and compactions. - Pick all tables from all levels, create a changeset to delete all these tables and apply it to manifest. - Pick all log files from value log,
()
| 1556 | // any reads while DropAll is going on, otherwise they may result in panics. Ideally, both reads and |
| 1557 | // writes are paused before running DropAll, and resumed after it is finished. |
| 1558 | func (db *DB) DropAll() error { |
| 1559 | f, err := db.dropAll() |
| 1560 | if f != nil { |
| 1561 | f() |
| 1562 | } |
| 1563 | return err |
| 1564 | } |
| 1565 | |
| 1566 | func (db *DB) dropAll() (func(), error) { |
| 1567 | db.opt.Infof("DropAll called. Blocking writes...") |