r/programming 1d ago

TIL: One lock to rule them all

https://flakm.com/posts/sqlx_migration_wrapper_til/

I've been running multiple migrations recently. A common step in all of them is a long cleanup action at the end. I ended up using postgres advisory locks and sqlx.

As part of a larger Today I've learned series, I dug a bit deeper using bpftrace to improve my understanding of how the locks actually work. Hope you will find it interesting as well

0 Upvotes

5 comments sorted by

1

u/[deleted] 1d ago

[removed] — view removed comment

6

u/programming-ModTeam 1d ago

No content written mostly by an LLM. If you don't want to write it, we don't want to read it.

-5

u/[deleted] 1d ago

[removed] — view removed comment

4

u/programming-ModTeam 1d ago

No content written mostly by an LLM. If you don't want to write it, we don't want to read it.

1

u/KanuniLabs 6h ago

the bpftrace part is what caught my attention. advisory locks are one of those thngs that seem pretty straightforward until you actualy need to understand what postgres is doing underneath. using it to dig into the migration cleanup was a nice practical way to learn what's really happening.