V3.2103.0 Db crash after power loss

Can’t post the traceback.

panic: runtime error: index out of range [3] with length 0 [recovered]
panic:
== Recovering from initIndex crash ==
File Info: [ID: 1808, Size: 19952177, Zeros: 483889]
isEnrypted: false checksumLen: 0 checksum: indexLen: 0 index:
== Recovered ==

There were two applications using BadgerDb on the same machine.
They both have the same error.

Can’t post the traceback +1 (This discuss site is much worse than github issue, can’t reply to a post 3 times, can’t paste more than 3 links…)

After some digging, I found it probably caused by the msync call when memtable is flushed to the sst.
And apply this patch of ristretto/pull/283,it should fix the panic.

by the way, there are some other things that may cause problems on windows, such as O_SYNC is not supported, see: golang/go#35358 and [golang/go#39245] When the power is off, theoretically it may affect the placement of vlog and WAL.