Context manager generator for retry block pattern and decorator.

Since our testing infrastructure still uses sqlite, I don't think we can raise an error here, can we? I can log a warning though.