Transaction Web Service operations

This topic lists the operations available in the Transaction Web Service.

A request to the Transaction Web Service consists of a Request element.

The operations are the following:
Operation Description
startOuterTransaction An operation to begin an outer transaction. You can optionally provide a transaction ID in the OuterTransactionId element.

If this operation succeeds, it starts the outer transaction and returns a transaction ID, and the Dgraph process enters transaction mode.

If this operation does not succeed, the Dgraph process does not start an outer transaction, and does not return a transaction ID.

While an outer transaction is in progress, the following actions take place:
  • All queries that reference the transaction ID are processed within the transaction. Updating queries that do not reference the transaction ID wait until the outer transaction is committed (or rolled back) and are computed based on the published transaction version of the index.
  • Read-only queries that do not reference the transaction ID are not rejected — they are processed against the published version of the index.

Updates applied within the outer transaction do not become a published version of the index until another operation, commitOuterTransaction, returns successfully.

listOuterTransaction An operation to request an ID of a running outer transaction. If an outer transaction is in progress, this operation returns its ID.
rollBackOuterTransaction An operation to roll back an outer transaction with the ID specified in the OuterTransactionIdToRollBack element.
commitOuterTransaction An operation to end an outer transaction.

If an outer transaction with the specified ID is in progress, then if the operation succeeds, the Dgraph process commits the transaction and exits transaction mode. The Dgraph process resumes accepting unqualified queries. The version of the index that is propagated to all nodes becomes the last published version.

If the operation does not succeed, the outer transaction is not committed. The Dgraph process does not apply any updates that referenced the transaction ID. All queries continue to use the pre-transaction version of the index.

Note: If the outer transaction fails to commit, it remains open, and you cannot start another outer transaction before committing or rolling back the one that failed. Without stopping the Dgraph process, you can manually commit the transaction and roll back any changes using the rollBackOuterTransaction operation, specifying the ID of the transaction. If, in another possible scenario, the outer transaction fails to commit because the Dgraph fails, the transaction is not applied and does not need to be rolled back manually.