What version of Go are you using (go version
)?
$ go version 1.16.3
What operating system are you using?
macos big sur
What version of Badger are you using?
v3.2011.1
Does this issue reproduce with the latest master?
Steps to Reproduce the issue
Opening badger db something like this
func BadgerDB(storePath string) {
var newClient BadgerDbClient
opts := badger.DefaultOptions(storePath)
opts.Dir = storePath
opts.ValueDir = storePath
opts.DetectConflicts = true
opts.CompactL0OnClose = true
opts.Logger = nil
opts.SyncWrites = true
opts.EncryptionKey = encryptionkey
opts.EncryptionKeyRotationDuration = 24 * time.Hour
client, err := badger.Open(opts)
if err != nil {
log.Errorln("DBProvider() failed to open", newClient.Err)
return &newClient
} else {
return &newClient
}
}
What Badger options were set?
opts.Dir = storePath
opts.ValueDir = storePath
opts.DetectConflicts = true
opts.CompactL0OnClose = true
opts.Logger = nil
opts.SyncWrites = true
opts.EncryptionKey = encryptionkey
opts.EncryptionKeyRotationDuration = 24 * time.Hour
What did you do?
Able to open the db the first time, however after closing it an attempt to reopen panics
What did you expect to see?
Able to open the db
What did you see instead?
panic: Index Cache must be set for encrypted workloads [recovered]
panic:
== Recovering from initIndex crash ==
File Info: [ID: 1, Size: 814, Zeros: 0]
isEnrypted: true checksumLen: 6 checksum: sum:1381902636 indexLen: 208 index:
Are there additional configuration that must be added to ensure proper reopening of the DB?