CoreyKaylor / Lightning.NET

.NET library for LMDB key-value store
Other
397 stars 82 forks source link

LightningEnvironment.CopyTo Corruption #165

Closed DecoyFish closed 10 months ago

DecoyFish commented 12 months ago

We've encountered a case in which a DB saved via LightningEnvironment.CopyTo was corrupted. Looking at the code, this method calls Lmdb.mdb_env_copy2, but doesn't appear to do anything with the returned result code. Is this by design (as there might be no viable way for this to fail), or should CopyTo return a MDBResultCode?

AlgorithmsAreCool commented 12 months ago

I've never used this function, but disregarding the return code doesn't seem like correct behavior. We should probably change it to throw on a failing return code.

DecoyFish commented 11 months ago

Thanks, I've opened the following PR with the change and a test: #166

CoreyKaylor commented 10 months ago

Thanks, PR is merged and sorry for the hiatus. I've had quite a lot going on in my personal life lately.

DecoyFish commented 10 months ago

No worries. Thanks for maintaining this awesome project.