Posts with the tag Postgresql:

Fighting spam inside the database because LOL

Summary: Mastodon has few tools for automatedly fighting spam and abuse so I gave up and made one.

We’ve been swamped with a flood of spam for the last few days. Some loser is creating hundreds or thousands of accounts on undermoderated servers and pestering the whole fediverse with junk. Mastodon itself provides no mechanism for admins to reject statuses that contain certain strings, even though many people have begged for this over the years. And while I could learn enough Ruby on Rails to implement such a feature myself, I’m not confident that it would be accepted into the main project and I don’t want to maintain a fork.

I fought PostgreSQL (and eventually won)

We had severeral hours of downtime yesterday because of a “fun” PostgreSQL problem (see Beware of your next glibc upgrade for details). Short version: because there are lots of ways to encode text, and they can change subtly when you upgrade your OS, some of your unique database keys may end up being not so unique. This resulted in quite a few Mastodon tables having duplicate rows, despite having unique indexes. It also meant that PostgreSQL was all like “indexes? lol never heard of ’em” and query performance was pretty awful.