I have a database accessed by an several servers, let's call them workers. These workers take one item from the database, do some operations on it and then update it back into the database. The workers are also volatile, there can be any amount of them and they can die/start at any time.
My problem is coordination of resources across workers. I want to ensure that there aren't 2 workers working on the same item. I also want to ensure that if a worker dies while he was working on an item, this item will be released to another server (either immediately or via timeout).
How can I ensure this coordination? I know that I can implement some custom logic myself using database transactions and some kind of server discovery/monitoring.
This seems like a common problem but I am having a hard time googling for a solution, I don't know which terms to search for.