Skip to content

Fix concurrent generation increments failing

Sami Hiltunen requested to merge smh-fix-outdated-nodes into master

IncrementGeneration is failing when two transactions concurrently update the generations. The issue seems to be that the UPDATE statements sees old generation values for the replicas when it compares their generation to the repository's generation. Rearranging the query to perform the updates on pre-selected list of replicas seems to work around the issue. Likewise, the repository generation updating CTE was changed to rely on the records of the replica updates more than just checking whether some replicas were updated with EXISTS. In combination, these two changes result in correct behavior. I don't completely understand what is the underlying logic that changes but it does seem like the CTE updating the generation number interplays with the replica updates in a bad manner.

Edited by Sami Hiltunen

Merge request reports

Loading