https://slatedb.io logo
I wrote a thing about handling data corruption in ...
# general
t
I wrote a thing about handling data corruption in SlateDB, its not exhaustive, but I would like to get additional eyes on it before I continue. https://github.com/slatedb/slatedb/pull/411
c
Still reading, but the survey of other systems is awesome! Well done.
TIL SQLite silently drops WAL frames 💀
Posted a review!
t
I'm circling back around to this again today.... I started writing a new section on handling corruption during the compaction cycle, which is completely async. Since compaction is async, and we can't even guarantee that compaction is running on the particular instance of SlateDB we are currently on, cordinating between the async work, and the user is likely out of scope for SlateDB. My idea here is to provide a callback function via
DBOptions
such that when compaction encounters an issue, it calls the callback function provided by the user. From within the CallBack the user could - Crash the application - Coordinate with other instances running SlateDB (inform other instances the DB is corrupt, and take appropriate action) - Auto Repair the corruption - Ignore the corruption - Notify someone via pagerduty etc... More I thought about this, the more I wonder if we could simplify WAL and SST corruption reporting by using this call back for every instance of corruption. Any operation which encounters corruption will defer control to the provided call back, notifying the developer of the corruption and allow the developer to decide how to handle the corruption. The developer can also signal to via return values wether to continue or abort the operation in question. The semantics in the face of corruption would be. - Calls to
get
invoke the call back function - Errors found in the WAL during DB open invoke the call back function - Errors found during compaction invoke the call back function. This allows corruption to be handled in a central point, and puts the developer in control of how corruption is handled. Thoughts?
On the topic of multiple versions of keys in SSTables. Is that something slateDB does today? My knowledge of how SlateDB does compaction is limited currently. 😬
Ah, at L0, SST files may contain overlapping key ranges. 🤔
In that case, the call back idea is even more compelling as the call back would be called even if an older/newer key is found. ✨
c
I like this. It required some thought about what gets passed in and out of the callback, and if/how it can affect the read in question. A concrete API proposal would help.
t
I've updated the corruption PR, incorporating all the feed back.
c
Saw! Will take a look today/tomorrow 🤞
Holiday is starting to encroach on my productivity 😅
Thanks again for doing this. Really interesting discussion
t
No rush, I'm enjoying the opportunity to learn and build something new.
I learn via the "take the hill" method. I try to take the hill, die in the process, learn something new, then try to take the hill again, repeat. AKA: Make lots of mistakes, try again, have fun while doing it.
c
Hey, it's the only way to collect battle scars!
t
> One other note: the RFC should mention corrupt cache files local disk as well. In that case, I think we want to delete them and retry (and detect if they are corrupted on object storage during retry). I wasn't aware that we had cache files on local disk. Are you suggesting that if we encounter corruption in local cache files we avoid calling
DBOptions.on_corruption
and just delete the cache file instead?
c
@flaneur233 implemented the localc cache. Take a look at the cache_object_store.rs file and related ones.
And ya my though was that we should drop the file, check the object store, and redownload if it's still healthy. But there might be better ways to do this.
Also the object store files are segmented on disk.. and I think they might have checksums as well. @flaneur233 has more context
Looks like we don't have checksums on local cache segments right now
We should document this for sure... Needs a GH issue
t
I've updated the RFC.
f
i suppose that simply ignore the corrupt cache file is ok, just fall back to the backend with some warnings logs. the corrupted log files could be removed by the evictor automatically 😯
2 Views