func (s *session) flushMemdb(rec *sessionRecord, mdb *memdb.DB, level int) (level_ int, err error) { // Create sorted table. iter := mdb.NewIterator(nil) defer iter.Release() t, n, err := s.tops.createFrom(iter) if err != nil { return level, err } // Pick level and add to record. if level < 0 { level = s.pickMemdbLevel(t.imin.ukey(), t.imax.ukey()) } rec.addTableFile(level, t) s.logf("memdb@flush created L%d@%d N·%d S·%s %q:%q", level, t.file.Num(), n, shortenb(int(t.size)), t.imin, t.imax) return level, nil }
func (b *Batch) revertMemReplay(to *memdb.DB) error { return b.decodeRec(func(i int, kt kType, key, value []byte) { ikey := newIkey(key, b.seq+uint64(i), kt) to.Delete(ikey) }) }