The task is: generate and use next id for the record during update.
That means i have record that have someid field.
I need to set next id value and update record. The main condition is to have id without gaps, even
in case if multiple transactions running and trying to get next id (and some of them may fail).
In usual case with single db server instance I would use exclusive lock (select ... for update) to have last id, increment it and update rows.
But how to achieve the same locking in distributed environment?
How to lock the same row on multiple nodes?
And is it possible to have an exclusive lock (select ... for update) for a row across all nodes at all?
Thanks for your time!