The CABlog

DPT: Install the right version of your embedded database

Hey (singular) blog reader,

Today comes a developer pro tip, sponsored by me exhausting my available disk space on my SSD.

When making something with Go, remember to install the latest version if you mean to - I am using Badger for the caching part of a project that I'm making along side a few other makers in Lets Make Things together (LMT2). I built this part so I would not have to hit the free public services as hard and would only have to send the request once, problem is, I installed the base package badger rather than badger/v4. I have done a similar endeavour before and knew it to only take up 120GB previously, so you can imagine my surprise when I unlocked my PC this morning to see that all 400 free GB of space were used up. How could this be I wondered?

First I tried stripping out some needless data, although that didn't seem to alleviate the problem at all, only appearing to make it worse (although this was hastily written code so it could totally be a mistake on my part). Then I searched for compression, as I was near certain that it was a feature of Badger, but couldn't find anything in their official docs, and unsurprisingly, I also was on the v1 badger documentation on the gopkg site, so I was very confused finding that an option I thought I had previously used no longer existed. After a while I noticed the friendly little banner on gopkg reminding me that there was a later version - where I immediately found the familiar options, and even learned that compression was turned on by default, what a good decision.

I probably could've figured out how to migrate from v1 through v4, but figured with the limited disk space it was probably just easier to wipe the directory and sync it again - slight shame as it makes the attached app way slower while it catches back up to where it was, but I have made it around 50% through all the stuff I've got to parse for an MVP :)

Moral of the story - check you're on the version you really want in Go! It would've saved me a good few hours haha.

Have a great day ahead, ~ CA

Like what I write? Subscribe to my Mailing List or RSS feed.

Comments? Questions? Feel free to send me an Email.

This post was last edited 4 months, 2 weeks ago.