Skip to content

Commit

Permalink
Initialize db in pebble DB batch (#128)
Browse files Browse the repository at this point in the history
  • Loading branch information
jmalicevic committed Jan 30, 2024
1 parent 8fd0e20 commit 7ebb916
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions pebble.go
Original file line number Diff line number Diff line change
Expand Up @@ -207,6 +207,11 @@ var _ Batch = (*pebbleDBBatch)(nil)

func newPebbleDBBatch(db *PebbleDB) *pebbleDBBatch {
return &pebbleDBBatch{
// For regular batch operations batch.db is going to be set to db
// and it is not needed to initialize the DB here.
// This is set to enable general DB operations like compaction
// (e.x. a call do pebbleDBBatch.db.Compact() would throw a nil pointer exception)
db: db,
batch: db.db.NewBatch(),
}
}
Expand Down

0 comments on commit 7ebb916

Please sign in to comment.