-
Notifications
You must be signed in to change notification settings - Fork 1.5k
spanner: Add lastUseTime parameter to session #8943
Copy link
Copy link
Closed
Labels
api: spannerIssues related to the Spanner API.Issues related to the Spanner API.
Description
In the current golang implementation, there is no track of when the session was last used with in a transaction. This would be helpful to implement session leaks cleanup and other behaviours of session.
- Add a new field
lastuseTimein sessionHandle similar to Java client to keep track of when the session was last used in a transaction. - If we make successive RPC calls within a transaction, this parameter is not tracked, and should get updated with subsequent RPC calls. For ex, consider the below sample,
_, err := client.ReadWriteTransaction(ctx, func(ctx context.Context, tx *ReadWriteTransaction) error {
// first RPC, session lastUseTime should be updated
_, err := tx.Update(ctx, NewStatement(UpdateBarSetFoo))
if err != nil {
return err
}
// second rpc, session lastUseTime should be updated
_, err = tx.Update(ctx, NewStatement(UpdateBarSetFoo))
if err != nil {
return err
}
return nil
})
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
api: spannerIssues related to the Spanner API.Issues related to the Spanner API.