dbmate icon indicating copy to clipboard operation
dbmate copied to clipboard

dbmate should roll the transaction back on sigint

Open wkalt opened this issue 4 years ago • 2 comments

I think today there is a shutdown race that sometimes causes a rollback, but to make it consistent I think we need a signal handler in here: https://github.com/amacneil/dbmate/blob/master/pkg/dbmate/db.go#L188,L203

How about the first sigint triggers the rollback (and subsequent exit), and the second one does an immediate exit?

wkalt avatar Oct 21 '19 03:10 wkalt

https://github.com/amacneil/dbmate/issues/99 would change the location of the signal handler

wkalt avatar Oct 21 '19 04:10 wkalt

Sounds good. I like the behavior of graceful shutdown on first signal and hard exit on second.

We should probably handle SIGTERM the same way, I don't know what our current behavior is.

amacneil avatar Oct 21 '19 16:10 amacneil