Cannot use badger in Disk-less mode with Dir or ValueDir set - --badger 'inmemory=true;' InMemory:true is broken in 21.03

Report a Dgraph Bug

What version of Dgraph are you using?

Dgraph Version


Have you tried reproducing the issue with the latest release?

This is the latest 21.03 image available on dockerhub.

Steps to reproduce the issue (command/config used to run Dgraph).

dgraph alpha --badger 'inmemory=true;' <etc>

Expected behaviour and actual result.

InMemory:true is properly passed to Badger, but according to the logs, it appears that conflicting options Dir and ValueDir are added in, causing a fatal error. The following are relevant parts of the logs:

See here that Dir and ValueDir appropriately have no value and InMemory:true

I0529 14:36:11.508036      20 run.go:757] x.WorkerConfig: 
Badger:{Dir: ValueDir: SyncWrites:false NumVersionsToKeep:1 ReadOnly:false Logger:0xc000134d70 Compression:1 InMemory:true

but a few logs afterward, see that Dir and ValueDir now have values, which conflict with InMemory:true

 I0529 14:36:11.509973      20 server_state.go:140] Opening postings BadgerDB with options: {Dir:p ValueDir:p SyncWrites:false NumVersionsToKeep:2147483647 ReadOnly:false Logger:0x33f30c0 Compression:1 InMemory:true
[Sentry] 2021/05/29 14:36:11 Sending fatal event [629a2482fa3f4e48a81988a01bde13e6] to project: 5208688
2021/05/29 14:36:11 Cannot use badger in Disk-less mode with Dir or ValueDir set