Session lastUseTime
parameter not updated correctly for a Transaction
#2659
Labels
api: spanner
Issues related to the googleapis/java-spanner API.
Each pooled session has a parameter
lastUseTime
which indicates the timestamp when the session was last used. If we make successive RPC calls within a transaction, this parameter only gets updated at the start of the transaction (when we begin transaction) and does not get updated with subsequent RPC calls. For ex - Consider the below sampleBug : In the above example we would expect the timestamp to get updated for each
executeUpdate
RPC. However that is not the case. We are only updating the timestamp when we invokemanager.begin()
. Furthermore, theTransactionContext
class does not have access to thePooledSession
object.Impact - While this won't have any major impact when small number of RPCs are clubbed within a transaction, but for cases where we have say 100's or 1000's of RPC clubbed in a single transaction, the over-all transaction may execute for hours. If we don't update the
lastUseTime
correctly, existing session pool maintenance activities like idle session removal, pinging sessions, etc. may all behave incorrectly as they see a stale timestamp.Another interface through which RPCs can be chained
While we would expect the timestamp to get updated for each
transaction.read
call, it only gets updated forrunner.run
.Solution Approaches
Approach 1 - #2684
Approach 2 - #2704
The text was updated successfully, but these errors were encountered: