How locking, dequeue and TaskState::InProgress are working together
#31
Closed
kirillsalykin
started this conversation in
General
Replies: 1 comment 4 replies
-
|
That's how underway works today: in fact other transactions never see the "in-progress" state so it's probably redundant. On that note, there's no doubt a decent amount of optimization that could be done with the queries an especially indices. |
Beta Was this translation helpful? Give feedback.
4 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Hi,
Could you please help me understand how locking, dequeuing, and TaskState::InProgress are working together now? I'm not sure I fully understand this.
The reason I'm interested is that I implemented things a bit differently:
Pendingstatus, using SKIP LOCKED.Pendingstate. (even if transaction was not rolled back by the worker - it will be rolled back by psql)This approach renders the
InProgressstate redundant.The
InProgressapproach assumes that if a worker is interrupted, the task should be switched back toPending(so all cases should be handled). I initially used theInProgressapproach as well, but because we were using preemptible nodes, the workers were frequently interrupted. Occasionally, due to an unknown issue (maybe a race condition?), some jobs ended up stuck in the InProgress state without any workers running them.Maybe it's just my bad experience.
There is a downside to my approach as well: if a task runs for a long time, it keeps the transaction open, which is not considered good practice.
What do you think?
Beta Was this translation helpful? Give feedback.
All reactions