Method: projects.instances.databases.sessions.rollback

Rolls back a transaction, releasing any locks it holds. It is a good idea to call this for any transaction that includes one or more sessions.read or sessions.executeSql requests and ultimately decides not to commit.

sessions.rollback returns OK if it successfully aborts the transaction, the transaction was already aborted, or the transaction is not found. sessions.rollback never returns ABORTED.

HTTP request

POST https://spanner.googleapis.com/v1/{session=projects/*/instances/*/databases/*/sessions/*}:rollback

The URL uses gRPC Transcoding syntax.

Path parameters

Parameters
session

string

Required. The session in which the transaction to roll back is running.

Authorization requires the following IAM permission on the specified resource session:

  • spanner.databases.beginOrRollbackReadWriteTransaction

Request body

The request body contains data with the following structure:

JSON representation
{
  "transactionId": string
}
Fields
transactionId

string (bytes format)

Required. The transaction to roll back.

A base64-encoded string.

Response body

If successful, the response body is empty.

Authorization scopes

Requires one of the following OAuth scopes:

  • https://www.googleapis.com/auth/spanner.data
  • https://www.googleapis.com/auth/cloud-platform

For more information, see the Authentication Overview.