Use of setReadVersion


I am trying to circumvent the errors 1037 my app may get when one of the storage server is lagging. The approach I intended to use was to keep track of the most recent read version seen during a successful read and to recreate a transaction using this read version whenever an error 1037 is encountered.

It seems this is not working as intended since right after setting the read version (using setReadVersion), any use of the transaction generates an error 1007 (transaction too old).

Is there a link between the forced read version and the way the transaction age is determined?

What other way around the 1037 errors could I explore? In my particular use case, reading ‘old’ data is fine.

I think is why you see transaction_too_old here, and you can mitigate that by getting a read version at least once the normal way on your database object.

Hope that helps

Thanks for your answer. I don’t know if that is what I’m hitting. The doc for the setReadVersion method also states:

If the version is set too far in the past, transaction_too_old errors will be thrown from read operations.

So it might just be that I was setting a version “too far in the past”, whenever that is…

Too far in the past is basically 5 seconds ago