[DRAFT][18.0] Use session-level advisory lock for requeuing jobs#907
[DRAFT][18.0] Use session-level advisory lock for requeuing jobs#907
Conversation
|
Hi @sbidoul, |
fed50d4 to
ffbc8f7
Compare
|
I think we had considered that, but worried about potential conflicts with other advisory locks as it can potentially hit a wide range of lock ids. Not sure if we had thought about the two keys locks. As it is mentioned that the one key and two keys lock spaces do not overlap, maybe it's not an issue. cc/ @AnizR |
|
Ah, pgbouncer. Folks using pgbouncer have it with transaction-level pooling which is not compatible with session level advisory locks? |
Yes, that's a problem. There is still the option to configure job workers to connect directly to the the database or to use pgdog that now seems to supports session-level advisory locks. At first sight, that would be acceptable to me with a bump of the major version, but could be interesting to have more insights. |
ffbc8f7 to
0b64d37
Compare
|
As a data point, pgbouncer is the one supported out of the box by cloudnative-pg and we consider using it more to leverage transparent switchover. |
Interesting! When looking for info, I found this saying they consider removing the pooler: cloudnative-pg/cloudnative-pg#6869 (comment). It's a tangeant because it might not change anything, but worth sharing anyway. |
In deed, it was my first approach but, potential conflicts were the main worry and didn't thought of using 2 keys. I think that we had another issue but can't remind which one. Otherwise, the PR seems promising! |
It shouldn't be an issue because the advisory lock used here is at the session level (connection), so transactional commit/rollbacks have no effect. As for releasing, there is a finally clause around the execution of the job that calls |
No description provided.