Invalidate vxid caches when the vxid wraps
To avoid vxid clashes, we add a vxid generation number which is increased every time the global vxid counter wraps.
Any vxid caches from a previous generation are invalidated.
This patch should fix #3775 if the latest hypothesis is correct that transaction inconsistencies in the vsl reader are caused by vxid clashes due to vxid caching on the varnishd side.
Implementation notes:
-
The global generation counter value is deliberately read outside the lock to keep the performance impact minimal. It should not matter if an outdated value is read momentarily, because the time scale of vxids is some orders of magintudes larger than that of SMP cache inconsistencies.
-
This implementation invalidates vxid caches earlier than it absolutely needed to, but I decided to go with this idea for its simplicity in contrast to calculating a distance between the global vxid base and the cached value.
This change is made obsolete by plans to move to 64bit VXIDs, but I would like to keep it open until I port it to the 6.0 branch.
I am going to flag it with r=6.0. Please close when done