Configuration options to minimize file corruption

I have EventStore(5.0.5) running in embedded mode on desktop software running on Windows tablets.

Looking in our logs there is occasional entries like:
InvalidReadException: Log record at actual pos 155425642 has non-positive length: 0. in chunk #6-6
or
.CorruptDatabaseException: Corrupt database detected. —> EventStore.Core.Exceptions.ChunkNotFoundException: C:\ProgramData\BlastIQ_Local\Data\eventstore\data\chunk-000000.000000 not found.

I’m assuming these errors are caused by power loss events corrupting the database. Looks like the recommended approach is to disable disk cache:
https://groups.google.com/g/event-store/c/ExRshqwyW0I

However, I don’t have control over the OS’s the software is installed on.

Will setting WriteThrough=true & Unbuffered=true achieve the same?

Is the OS disk caching option more effective than those flags?

Are there any other settings that can be configured to minimize power loss file corruption?

Thanks

I don’t think that ESDB is designed to run in such environments. We can do just as much to ensure that the data is persisted but at the end it’s the OS that decides how to handle the IO.

I inherited the application architecture & am trying to make it as stable as I can.

I take it from your reply the OS cache option is the ideal way to achieve this.

Are you able to shed any light on what WriteThrough=true & Unbuffered=true achieve?

Here is what I found (comment from Greg): https://github.com/EventStore/EventStore/issues/2114#issuecomment-602666897

– What is the difference between --write-through and --unbuffered
These are options you likely do not want to touch. These names align to the names in windows but work in linux as well. Unbuffered is with use unbuffered/directio (aligned writes etc). Writethrough controls the writethrough flag which states that if there is a cache it should go through that cache.

So you can try setting those two to true and maybe it helps.