insidegui/WWDC

Database compression

insidegui opened this issue · 12 comments

As described in #578, the ConfCore.realm file can get quite big. Realm offers a way to re-save a database file in a way that compresses it. I remember trying to do this automatically a long time ago but having trouble getting it to work reliably.

Maybe something changed that would allow us to implement this now, or at least offer a manual way for the user to do so that doesn't require downloading another piece of software.

bcmn commented

There's some intriguing Realm docs about the causes of larger-than-expected Realm files, especially around accessing while using GCD. I've not had a chance to work out if any of these might be describing what's happening here.

I'll probably try and attempt the config changes described here when I get a chance.

I've also seen some fairly "nuclear option" implementations of forcing a re-compression, where people will write another realm file and swap it out. 😶😷

I believe the shouldCompactOnLaunch thing is what I tried before and it caused an awful hang when launching the app. We could try it again to see if it's better now tho.

bcmn commented

🤔 Interesting, okay.

@insidegui I've just been comparing some Time Machine snapshots to see why it sometimes needs to back up more than I would expect, and I found an interesting file in the diff - a ~/Library/Application Support/io.wwdc.app/ConfCore.realm weighing 38.65 GB… this is not normal, is it? 😬

We've had some builds in the past that entered sync loops, causing the database file to grow in that way. If you've been using the app for a long time, it's possible you were affected. Unfortunately, there's no easy solution I can recommend besides just nuking your database file and starting over :/

What do I lose if I do that?

Favorites, bookmarks and video progress (watched/unwatched). The rest is downloaded from the service.

So favorites and watched status aren't synced between computers?

They are. If you’re using iCloud sync, they should be restored. Keep a copy of the original db file just in case.

Ok, thanks 👍

Handled in #596

Let us know how it goes for your database @mackuba. I expect it may hang the first time you launch the app with this enabled, but afterwards it should be fine.

Just FYI: this has been temporarily disabled in version 7.1 as we wait for Realm to fix realm/realm-swift#6652