I agree, it's easier to debug, but it wouldn't happen. And optimistic locking is known to turn into pessimistic when working with high write traffic.

Even if we limit number of tries we shouldn't raise exception. Just walking away is ok here - it's like we ran our invalidation a bit earlier and newly fetched queries (which changed schemes) came later. In this case 2 tries would be sufficient to guarantee that we invalidated on schemes recent enough.